---
title: "defineJob()"
description: "Defines a job"
---

A [Job](/documentation/concepts/jobs) is used to define the [Trigger](/documentation/concepts/triggers), metadata, and what happens when it runs.

<RequestExample>

```ts example
client.defineJob({
  id: "github-integration-on-issue",
  name: "GitHub Integration - On Issue",
  version: "0.1.0",
  trigger: github.triggers.repo({
    event: events.onIssue,
    owner: "triggerdotdev",
    repo: "empty",
  }),
  run: async (payload, io, ctx) => {
    await io.logger.info("This is a simple log info message");
    return { payload, ctx };
  },
});
```

```ts notifications
client.defineJob({
  id: "github-integration-on-issue",
  name: "GitHub Integration - On Issue",
  version: "0.1.0",
  trigger: github.triggers.repo({
    event: events.onIssue,
    owner: "triggerdotdev",
    repo: "empty",
  }),
  onSuccess: async (notification) => {
    console.log("Job succeeded", notification);
  },
  onFailure: async (notification) => {
    console.log("Job failed", notification);
  },
  run: async (payload, io, ctx) => {
    await io.logger.info("This is a simple log info message");
    return { payload, ctx };
  },
});
```

</RequestExample>

## Parameters

<Snippet file="jobs/options.mdx" />

## Returns

<ResponseField name="Job instance" type="Job" />
