> ## Documentation Index
> Fetch the complete documentation index at: https://trigger-v3-fix-additional-files.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Webhooks allow you to subscribe to events from APIs you use.

Webhooks are a crucial part of API development, allowing for real-time reactions to various events across different systems, such as when a Stripe Payment is made, or when a GitHub issue is created.

## Advantages of using Trigger.dev for webhooks

Webhooks can be difficult to work with, especially when developing locally. We make them far easier to use with our [Integrations](/integrations).

* You don't need to register/unregister for webhooks, we do it for you
* We receive the webhook, then keep trying to send it to you until you receive it. If your server goes down, no problem.

## Usage

There are three ways to use webhooks with Trigger.dev:

1. Use one of our built-in Integrations, such as [GitHub](/integrations/apis/github). We'll take care of registering the webhook for you.
2. Use our [HTTP endpoints](/documentation/concepts/http-endpoints) and [HTTP triggers](/documentation/concepts/triggers/http) to subscribe to any webhooks you want. This is useful if you want to use a service that we don't have an Integration for.
3. [Create your own Integration](/integrations/create) that registers for webhooks.

## Example

```ts Github
import { Job } from "@trigger.dev/sdk";
import { Github, events } from "@trigger.dev/github";

//GitHub integration with API Key (it supports OAuth too)
const github = new Github({
  id: "github",
  token: process.env.GITHUB_API_KEY!,
});

client.defineJob({
  id: "critical-issue-alert",
  name: "Critical Issue Alert",
  version: "0.1.0",
  //When a GitHub issue is modified on the triggerdotdev/trigger.dev repo
  trigger: github.triggers.repo({
    event: events.onIssue,
    owner: "triggerdotdev",
    repo: "trigger.dev",
  }),
  //include any integrations you want to use
  integrations: {
    slack,
  },
  //this function gets executed when the webhook is received
  run: async (payload, io, ctx) => {
    await io.logger.info(`Action was ${payload.action}`);
  },
});
```
