@trigger.dev/sdk 4.8.5 → 4.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/v3/ai.d.ts +34 -8
- package/dist/commonjs/v3/ai.js +304 -168
- package/dist/commonjs/v3/ai.js.map +1 -1
- package/dist/commonjs/v3/auth.d.ts +4 -4
- package/dist/commonjs/v3/auth.js +21 -75
- package/dist/commonjs/v3/auth.js.map +1 -1
- package/dist/commonjs/v3/chat-client.d.ts +1 -1
- package/dist/commonjs/v3/chat.d.ts +1 -1
- package/dist/commonjs/v3/prompt.js +6 -8
- package/dist/commonjs/v3/prompt.js.map +1 -1
- package/dist/commonjs/v3/runs.d.ts +5 -1
- package/dist/commonjs/v3/runs.js.map +1 -1
- package/dist/commonjs/v3/sessions.js +10 -7
- package/dist/commonjs/v3/sessions.js.map +1 -1
- package/dist/commonjs/v3/shared.d.ts +2 -2
- package/dist/commonjs/v3/shared.js +16 -15
- package/dist/commonjs/v3/shared.js.map +1 -1
- package/dist/commonjs/v3/steeringContext.d.ts +35 -10
- package/dist/commonjs/v3/steeringContext.js +86 -14
- package/dist/commonjs/v3/steeringContext.js.map +1 -1
- package/dist/commonjs/v3/streams.js +10 -8
- package/dist/commonjs/v3/streams.js.map +1 -1
- package/dist/commonjs/v3/tasks.d.ts +2 -2
- package/dist/commonjs/v3/tasks.js.map +1 -1
- package/dist/commonjs/v3/test/mock-chat-agent.js +24 -13
- package/dist/commonjs/v3/test/mock-chat-agent.js.map +1 -1
- package/dist/commonjs/v3/toolOutputJson.d.ts +17 -0
- package/dist/commonjs/v3/toolOutputJson.js +241 -0
- package/dist/commonjs/v3/toolOutputJson.js.map +1 -0
- package/dist/commonjs/v3/webhooks.d.ts +8 -2
- package/dist/commonjs/v3/webhooks.js +20 -11
- package/dist/commonjs/v3/webhooks.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/v3/ai.d.ts +34 -8
- package/dist/esm/v3/ai.js +306 -171
- package/dist/esm/v3/ai.js.map +1 -1
- package/dist/esm/v3/auth.d.ts +4 -4
- package/dist/esm/v3/auth.js +22 -76
- package/dist/esm/v3/auth.js.map +1 -1
- package/dist/esm/v3/chat-client.d.ts +1 -1
- package/dist/esm/v3/chat.d.ts +1 -1
- package/dist/esm/v3/prompt.js +6 -8
- package/dist/esm/v3/prompt.js.map +1 -1
- package/dist/esm/v3/runs.d.ts +5 -1
- package/dist/esm/v3/runs.js.map +1 -1
- package/dist/esm/v3/sessions.js +10 -7
- package/dist/esm/v3/sessions.js.map +1 -1
- package/dist/esm/v3/shared.d.ts +2 -2
- package/dist/esm/v3/shared.js +16 -15
- package/dist/esm/v3/shared.js.map +1 -1
- package/dist/esm/v3/steeringContext.d.ts +35 -10
- package/dist/esm/v3/steeringContext.js +85 -14
- package/dist/esm/v3/steeringContext.js.map +1 -1
- package/dist/esm/v3/streams.js +10 -8
- package/dist/esm/v3/streams.js.map +1 -1
- package/dist/esm/v3/tasks.d.ts +2 -2
- package/dist/esm/v3/tasks.js.map +1 -1
- package/dist/esm/v3/test/mock-chat-agent.js +25 -14
- package/dist/esm/v3/test/mock-chat-agent.js.map +1 -1
- package/dist/esm/v3/toolOutputJson.d.ts +17 -0
- package/dist/esm/v3/toolOutputJson.js +238 -0
- package/dist/esm/v3/toolOutputJson.js.map +1 -0
- package/dist/esm/v3/webhooks.d.ts +8 -2
- package/dist/esm/v3/webhooks.js +20 -11
- package/dist/esm/v3/webhooks.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/ai/observability.mdx +25 -19
- package/docs/ai/prompts.mdx +25 -19
- package/docs/ai-chat/actions.mdx +1 -1
- package/docs/ai-chat/anatomy.mdx +1 -1
- package/docs/ai-chat/backend.mdx +24 -24
- package/docs/ai-chat/background-injection.mdx +5 -5
- package/docs/ai-chat/chat-local.mdx +2 -2
- package/docs/ai-chat/compaction.mdx +47 -18
- package/docs/ai-chat/custom-agents.mdx +4 -4
- package/docs/ai-chat/error-handling.mdx +4 -4
- package/docs/ai-chat/fast-starts.mdx +8 -7
- package/docs/ai-chat/frontend.mdx +6 -2
- package/docs/ai-chat/lifecycle-hooks.mdx +11 -11
- package/docs/ai-chat/migrating-from-a-route-handler.mdx +4 -4
- package/docs/ai-chat/migrating-from-hydrate-messages.mdx +1 -1
- package/docs/ai-chat/overview.mdx +1 -1
- package/docs/ai-chat/patterns/branching-conversations.mdx +1 -1
- package/docs/ai-chat/patterns/database-persistence.mdx +2 -2
- package/docs/ai-chat/patterns/human-in-the-loop.mdx +1 -1
- package/docs/ai-chat/patterns/native-compaction.mdx +29 -9
- package/docs/ai-chat/patterns/persistence-and-replay.mdx +1 -1
- package/docs/ai-chat/patterns/redacting-telemetry.mdx +2 -2
- package/docs/ai-chat/patterns/skills.mdx +2 -2
- package/docs/ai-chat/patterns/sub-agents.mdx +1 -1
- package/docs/ai-chat/patterns/tool-result-auditing.mdx +1 -1
- package/docs/ai-chat/patterns/trusted-edge-signals.mdx +2 -2
- package/docs/ai-chat/patterns/version-upgrades.mdx +2 -2
- package/docs/ai-chat/pending-messages.mdx +5 -5
- package/docs/ai-chat/prompt-caching.mdx +7 -7
- package/docs/ai-chat/quick-start.mdx +2 -2
- package/docs/ai-chat/testing.mdx +9 -9
- package/docs/ai-chat/tools.mdx +9 -5
- package/docs/ai-chat/transcript-storage.mdx +2 -2
- package/docs/ai-chat/types.mdx +10 -3
- package/docs/apikeys.mdx +2 -1
- package/docs/cli-login-commands.mdx +12 -0
- package/docs/concurrency.mdx +40 -0
- package/docs/database-connections.mdx +1 -1
- package/docs/deploy-environment-variables.mdx +84 -2
- package/docs/deployment/trusted-publishing.mdx +4 -0
- package/docs/errors-retrying.mdx +25 -18
- package/docs/github-actions.mdx +1 -1
- package/docs/github-integration.mdx +32 -1
- package/docs/how-it-works.mdx +4 -2
- package/docs/introduction.mdx +1 -1
- package/docs/mcp-introduction.mdx +7 -1
- package/docs/mcp-remote.mdx +90 -0
- package/docs/oidc/azure.mdx +81 -0
- package/docs/oidc/databricks.mdx +99 -0
- package/docs/oidc/doppler.mdx +60 -0
- package/docs/oidc/gcp.mdx +109 -0
- package/docs/oidc/hugging-face.mdx +90 -0
- package/docs/oidc/openrouter.mdx +91 -0
- package/docs/oidc/snowflake.mdx +91 -0
- package/docs/oidc/vault.mdx +71 -0
- package/docs/oidc.mdx +2 -0
- package/docs/runs/metadata.mdx +1 -1
- package/docs/self-hosting/docker.mdx +2 -0
- package/docs/self-hosting/env/webapp.mdx +4 -1
- package/docs/self-hosting/kubernetes.mdx +2 -0
- package/docs/tasks/schemaTask.mdx +26 -13
- package/docs/tasks/streams.mdx +2 -2
- package/docs/troubleshooting.mdx +7 -0
- package/docs/webhooks/channels.mdx +6 -6
- package/docs/webhooks/connect.mdx +9 -75
- package/docs/webhooks/custom-providers.mdx +87 -0
- package/docs/webhooks/deliveries.mdx +7 -7
- package/docs/webhooks/filters.mdx +2 -2
- package/docs/webhooks/how-it-works.mdx +58 -0
- package/docs/webhooks/human-in-the-loop.mdx +3 -3
- package/docs/webhooks/linear.mdx +5 -3
- package/docs/webhooks/overview.mdx +20 -71
- package/docs/webhooks/own-handler.mdx +62 -0
- package/docs/webhooks/pricing-and-limits.mdx +13 -0
- package/docs/webhooks/providers/attio.mdx +38 -0
- package/docs/webhooks/providers/autumn.mdx +40 -0
- package/docs/webhooks/providers/cal-com.mdx +41 -0
- package/docs/webhooks/providers/calendly.mdx +41 -0
- package/docs/webhooks/providers/clerk.mdx +40 -0
- package/docs/webhooks/providers/discord.mdx +45 -0
- package/docs/webhooks/providers/docusign.mdx +41 -0
- package/docs/webhooks/providers/elevenlabs.mdx +41 -0
- package/docs/webhooks/providers/firecrawl.mdx +54 -0
- package/docs/webhooks/providers/github.mdx +46 -0
- package/docs/webhooks/providers/gitlab.mdx +41 -0
- package/docs/webhooks/providers/granola.mdx +44 -0
- package/docs/webhooks/providers/hookdeck.mdx +98 -0
- package/docs/webhooks/providers/infisical.mdx +41 -0
- package/docs/webhooks/providers/jira.mdx +41 -0
- package/docs/webhooks/providers/langfuse.mdx +40 -0
- package/docs/webhooks/providers/linear.mdx +45 -0
- package/docs/webhooks/providers/loops.mdx +40 -0
- package/docs/webhooks/providers/metronome.mdx +42 -0
- package/docs/webhooks/providers/mux.mdx +40 -0
- package/docs/webhooks/providers/openai.mdx +40 -0
- package/docs/webhooks/providers/pagerduty.mdx +40 -0
- package/docs/webhooks/providers/plain.mdx +41 -0
- package/docs/webhooks/providers/planetscale.mdx +40 -0
- package/docs/webhooks/providers/recall-ai.mdx +54 -0
- package/docs/webhooks/providers/replicate.mdx +41 -0
- package/docs/webhooks/providers/resend.mdx +44 -0
- package/docs/webhooks/providers/retell.mdx +41 -0
- package/docs/webhooks/providers/sentry.mdx +41 -0
- package/docs/webhooks/providers/shopify.mdx +49 -0
- package/docs/webhooks/providers/slack.mdx +48 -0
- package/docs/webhooks/providers/square.mdx +40 -0
- package/docs/webhooks/providers/stripe.mdx +86 -0
- package/docs/webhooks/providers/supabase.mdx +41 -0
- package/docs/webhooks/providers/tailscale.mdx +43 -0
- package/docs/webhooks/providers/typeform.mdx +42 -0
- package/docs/webhooks/providers/vapi.mdx +47 -0
- package/docs/webhooks/providers/vercel.mdx +40 -0
- package/docs/webhooks/providers/whatsapp.mdx +45 -0
- package/docs/webhooks/providers/workos.mdx +41 -0
- package/docs/webhooks/providers/zendesk.mdx +41 -0
- package/docs/webhooks/providers.mdx +53 -0
- package/docs/webhooks/quick-start.mdx +131 -0
- package/docs/webhooks/session-routing.mdx +6 -6
- package/docs/webhooks/signing-secrets.mdx +80 -0
- package/docs/webhooks/slack.mdx +11 -2
- package/docs/webhooks/verification.mdx +139 -0
- package/docs/webhooks/waiters.mdx +2 -2
- package/docs/webhooks/webhook-tasks.mdx +46 -0
- package/package.json +4 -5
- package/docs/migrating-from-v3.mdx +0 -332
- package/docs/webhooks/public-beta.mdx +0 -70
- package/docs/webhooks/sources.mdx +0 -252
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Attio webhooks"
|
|
3
|
+
sidebarTitle: "Attio"
|
|
4
|
+
description: "Receive and verify Attio webhooks with Trigger.dev. Check the HMAC-SHA256 signature in attio-signature and run a task for each Attio event."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.attio()` verifies the HMAC-SHA256 signature Attio sends in `attio-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/attio.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const attio = webhooks.endpoint.define({
|
|
13
|
+
id: "attio",
|
|
14
|
+
source: webhooks.attio(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const attioEvents = webhook({
|
|
18
|
+
id: "attio-events",
|
|
19
|
+
endpoint: attio,
|
|
20
|
+
onEvent: async ({ event }) => {
|
|
21
|
+
console.log(event);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
| Setting | Value |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| Source | `webhooks.attio()` |
|
|
29
|
+
| Verification | HMAC-SHA256 in `attio-signature` |
|
|
30
|
+
| Credential | Signing secret issued by Attio |
|
|
31
|
+
| Attio docs | [Attio webhook docs](https://docs.attio.com/rest-api/guides/webhooks) |
|
|
32
|
+
|
|
33
|
+
## Set up Attio
|
|
34
|
+
|
|
35
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
36
|
+
2. In Attio's developer settings, open your integration and add a webhook with the webhook URL and the events your subscribers need. You can also create it with Attio's webhooks API.
|
|
37
|
+
3. Attio generates the signing secret and returns it when the webhook is created; it's also shown in the developer settings. Copy it, then choose **Set signing secret** on the Trigger.dev endpoint.
|
|
38
|
+
4. Send a test event from Attio, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Autumn webhooks"
|
|
3
|
+
sidebarTitle: "Autumn"
|
|
4
|
+
description: "Receive and verify Autumn webhooks with Trigger.dev. Check the Svix signature and run a task for each Autumn event, filtered on event.type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.autumn()` verifies the Svix signature Autumn sends in the `svix-*` headers on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/autumn.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const autumn = webhooks.endpoint.define({
|
|
13
|
+
id: "autumn",
|
|
14
|
+
source: webhooks.autumn(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const autumnEvents = webhook({
|
|
18
|
+
id: "autumn-events",
|
|
19
|
+
endpoint: autumn,
|
|
20
|
+
filter: "event.type == 'billing.updated'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.autumn()` |
|
|
30
|
+
| Verification | Svix (`svix-id`, `svix-timestamp`, `svix-signature`) |
|
|
31
|
+
| Credential | Signing secret issued by Autumn |
|
|
32
|
+
| Event type | `event.type` |
|
|
33
|
+
| Autumn docs | [Autumn webhook docs](https://docs.useautumn.com/documentation/webhooks) |
|
|
34
|
+
|
|
35
|
+
## Set up Autumn
|
|
36
|
+
|
|
37
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
38
|
+
2. In the Autumn dashboard, open **Developer** and select the **Webhooks** tab. Choose **Add Endpoint**, enter the webhook URL and select the events your subscribers need.
|
|
39
|
+
3. Copy the endpoint's signing secret (it starts with `whsec_`), then choose **Set signing secret** on the Trigger.dev endpoint.
|
|
40
|
+
4. Choose **Send Test Event** in Autumn, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Cal.com webhooks"
|
|
3
|
+
sidebarTitle: "Cal.com"
|
|
4
|
+
description: "Receive and verify Cal.com webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-cal-signature-256 and run a task for each Cal.com event, filtered on event.triggerEvent."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.calCom()` verifies the HMAC-SHA256 signature Cal.com sends in `x-cal-signature-256` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/cal-com.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const calCom = webhooks.endpoint.define({
|
|
13
|
+
id: "cal-com",
|
|
14
|
+
source: webhooks.calCom(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const calComEvents = webhook({
|
|
18
|
+
id: "cal-com-events",
|
|
19
|
+
endpoint: calCom,
|
|
20
|
+
onEvent: async ({ event }) => {
|
|
21
|
+
console.log(event);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To run a subscriber only for some events, add a [filter](/webhooks/filters) on `event.triggerEvent`.
|
|
27
|
+
|
|
28
|
+
| Setting | Value |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Source | `webhooks.calCom()` |
|
|
31
|
+
| Verification | HMAC-SHA256 in `x-cal-signature-256` |
|
|
32
|
+
| Credential | Secret you generate on Trigger.dev |
|
|
33
|
+
| Event type | `event.triggerEvent` |
|
|
34
|
+
| Cal.com docs | [Cal.com webhook docs](https://cal.com/docs/developing/guides/automation/webhooks) |
|
|
35
|
+
|
|
36
|
+
## Set up Cal.com
|
|
37
|
+
|
|
38
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
39
|
+
2. Choose **Generate secret** on the Trigger.dev endpoint and copy the value.
|
|
40
|
+
3. In Cal.com, open **Settings > Developer > Webhooks** and add a webhook with the webhook URL and the events your subscribers need. Paste the secret into its secret field. The secret is optional in Cal.com but required here: without it, Cal.com doesn't sign deliveries and every one is rejected. Cal.com hides the secret after you save.
|
|
41
|
+
4. Send a test event from Cal.com, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Calendly webhooks"
|
|
3
|
+
sidebarTitle: "Calendly"
|
|
4
|
+
description: "Receive and verify Calendly webhooks with Trigger.dev. Check the HMAC-SHA256 signature in calendly-webhook-signature and run a task for each Calendly event, filtered on event.event."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.calendly()` verifies the HMAC-SHA256 signature Calendly sends in `calendly-webhook-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/calendly.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const calendly = webhooks.endpoint.define({
|
|
13
|
+
id: "calendly",
|
|
14
|
+
source: webhooks.calendly(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const calendlyEvents = webhook({
|
|
18
|
+
id: "calendly-events",
|
|
19
|
+
endpoint: calendly,
|
|
20
|
+
onEvent: async ({ event }) => {
|
|
21
|
+
console.log(event);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To run a subscriber only for some events, add a [filter](/webhooks/filters) on `event.event`.
|
|
27
|
+
|
|
28
|
+
| Setting | Value |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Source | `webhooks.calendly()` |
|
|
31
|
+
| Verification | HMAC-SHA256 in `calendly-webhook-signature` |
|
|
32
|
+
| Credential | The `signing_key` you set on the subscription |
|
|
33
|
+
| Event type | `event.event` |
|
|
34
|
+
| Calendly docs | [Calendly webhook docs](https://developer.calendly.com/api-docs/overview/webhooks/webhook-signatures) |
|
|
35
|
+
|
|
36
|
+
## Set up Calendly
|
|
37
|
+
|
|
38
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
39
|
+
2. Calendly webhooks are created through the API, on a paid plan. Choose a signing key (for example, the output of `openssl rand -hex 32`), then create the subscription with `POST https://api.calendly.com/webhook_subscriptions`, passing `url` (the webhook URL), `events`, `organization`, `scope` and `signing_key`. If you create the subscription from an OAuth app, Calendly generates the signing key instead.
|
|
40
|
+
3. Choose **Set signing secret** on the Trigger.dev endpoint and paste the signing key.
|
|
41
|
+
4. Send a test event from Calendly, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Clerk webhooks"
|
|
3
|
+
sidebarTitle: "Clerk"
|
|
4
|
+
description: "Receive and verify Clerk webhooks with Trigger.dev. Check the Svix signature and run a task for each Clerk event, filtered on event.type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.clerk()` verifies the Svix signature Clerk sends in the `svix-*` headers on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/clerk.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const clerk = webhooks.endpoint.define({
|
|
13
|
+
id: "clerk",
|
|
14
|
+
source: webhooks.clerk(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const clerkEvents = webhook({
|
|
18
|
+
id: "clerk-events",
|
|
19
|
+
endpoint: clerk,
|
|
20
|
+
filter: "event.type == 'user.created'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.clerk()` |
|
|
30
|
+
| Verification | Svix (`svix-id`, `svix-timestamp`, `svix-signature`) |
|
|
31
|
+
| Credential | Signing secret issued by Clerk |
|
|
32
|
+
| Event type | `event.type` |
|
|
33
|
+
| Clerk docs | [Clerk webhook docs](https://clerk.com/docs/guides/development/webhooks/overview) |
|
|
34
|
+
|
|
35
|
+
## Set up Clerk
|
|
36
|
+
|
|
37
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
38
|
+
2. Add the webhook URL as an endpoint in Clerk's webhook settings and subscribe it to the event types your subscribers need.
|
|
39
|
+
3. Copy the endpoint's signing secret (it starts with `whsec_`), then choose **Set signing secret** on the Trigger.dev endpoint.
|
|
40
|
+
4. Send a test event from Clerk, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Discord webhooks"
|
|
3
|
+
sidebarTitle: "Discord"
|
|
4
|
+
description: "Receive and verify Discord webhooks with Trigger.dev. Check the Ed25519 signature in x-signature-ed25519 and run a task for each Discord event, filtered on event.event.type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.discord()` verifies the Ed25519 signature Discord sends in `x-signature-ed25519` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/discord.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const discord = webhooks.endpoint.define({
|
|
13
|
+
id: "discord",
|
|
14
|
+
source: webhooks.discord(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const discordEvents = webhook({
|
|
18
|
+
id: "discord-events",
|
|
19
|
+
endpoint: discord,
|
|
20
|
+
onEvent: async ({ event }) => {
|
|
21
|
+
console.log(event);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To run a subscriber only for some events, add a [filter](/webhooks/filters) on `event.event.type`.
|
|
27
|
+
|
|
28
|
+
| Setting | Value |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Source | `webhooks.discord()` |
|
|
31
|
+
| Verification | Ed25519 signature in `x-signature-ed25519` |
|
|
32
|
+
| Credential | Discord's public key |
|
|
33
|
+
| Event type | `event.event.type` |
|
|
34
|
+
| Discord docs | [Discord webhook docs](https://docs.discord.com/developers/events/webhook-events) |
|
|
35
|
+
|
|
36
|
+
## Set up Discord
|
|
37
|
+
|
|
38
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
39
|
+
2. In the [Discord Developer Portal](https://discord.com/developers/applications), open the application and copy the **Public Key** from its **General Information** page. Choose **Set public key** on the Trigger.dev endpoint and paste it.
|
|
40
|
+
3. Open the application's **Webhooks** page. Set the **Endpoint URL** to the webhook URL, turn **Events** on, and select the event types your subscribers need. Discord sends a PING when you save, and the endpoint can only answer it once the public key is set.
|
|
41
|
+
4. Send a test event from Discord, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
42
|
+
|
|
43
|
+
## Endpoint validation
|
|
44
|
+
|
|
45
|
+
The endpoint answers Discord's verified PING with an empty `204`, so the PING creates no delivery or run.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "DocuSign webhooks"
|
|
3
|
+
sidebarTitle: "DocuSign"
|
|
4
|
+
description: "Receive and verify DocuSign webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-docusign-signature-1 and run a task for each DocuSign event, filtered on event.event."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.docusign()` verifies the HMAC-SHA256 signature DocuSign sends in `x-docusign-signature-1` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/docusign.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const docusign = webhooks.endpoint.define({
|
|
13
|
+
id: "docusign",
|
|
14
|
+
source: webhooks.docusign(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const docusignEvents = webhook({
|
|
18
|
+
id: "docusign-events",
|
|
19
|
+
endpoint: docusign,
|
|
20
|
+
onEvent: async ({ event }) => {
|
|
21
|
+
console.log(event);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To run a subscriber only for some events, add a [filter](/webhooks/filters) on `event.event`.
|
|
27
|
+
|
|
28
|
+
| Setting | Value |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Source | `webhooks.docusign()` |
|
|
31
|
+
| Verification | HMAC-SHA256 in `x-docusign-signature-1` |
|
|
32
|
+
| Credential | Connect secret key issued by DocuSign |
|
|
33
|
+
| Event type | `event.event` |
|
|
34
|
+
| DocuSign docs | [DocuSign webhook docs](https://developers.docusign.com/platform/webhooks/connect/) |
|
|
35
|
+
|
|
36
|
+
## Set up DocuSign
|
|
37
|
+
|
|
38
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
39
|
+
2. In DocuSign eSignature Admin, open **Connect > Connect Keys** and choose **Add Secret Key**. Copy the key: DocuSign shows it in full only once. Choose **Set signing secret** on the Trigger.dev endpoint and paste it.
|
|
40
|
+
3. Add a Connect configuration with the webhook URL, select the events your subscribers need, and tick **Include HMAC Signature**. Without it, DocuSign doesn't sign deliveries and every one is rejected.
|
|
41
|
+
4. Send a test event from DocuSign, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "ElevenLabs webhooks"
|
|
3
|
+
sidebarTitle: "ElevenLabs"
|
|
4
|
+
description: "Receive and verify ElevenLabs webhooks with Trigger.dev. Check the HMAC-SHA256 signature in elevenlabs-signature and run a task for each ElevenLabs event, filtered on event.type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.elevenlabs()` verifies the HMAC-SHA256 signature ElevenLabs sends in `elevenlabs-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/elevenlabs.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const elevenlabs = webhooks.endpoint.define({
|
|
13
|
+
id: "elevenlabs",
|
|
14
|
+
source: webhooks.elevenlabs(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const elevenlabsEvents = webhook({
|
|
18
|
+
id: "elevenlabs-events",
|
|
19
|
+
endpoint: elevenlabs,
|
|
20
|
+
onEvent: async ({ event }) => {
|
|
21
|
+
console.log(event);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To run a subscriber only for some events, add a [filter](/webhooks/filters) on `event.type`.
|
|
27
|
+
|
|
28
|
+
| Setting | Value |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Source | `webhooks.elevenlabs()` |
|
|
31
|
+
| Verification | HMAC-SHA256 in `elevenlabs-signature` |
|
|
32
|
+
| Credential | Signing secret issued by ElevenLabs |
|
|
33
|
+
| Event type | `event.type` |
|
|
34
|
+
| ElevenLabs docs | [ElevenLabs webhook docs](https://elevenlabs.io/docs/eleven-agents/workflows/post-call-webhooks) |
|
|
35
|
+
|
|
36
|
+
## Set up ElevenLabs
|
|
37
|
+
|
|
38
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
39
|
+
2. Add the webhook URL as a webhook in ElevenLabs and select the events your subscribers need. See ElevenLabs's [webhook docs](https://elevenlabs.io/docs/eleven-agents/workflows/post-call-webhooks) for where its webhook settings are.
|
|
40
|
+
3. Copy the signing secret ElevenLabs shows for the webhook, then choose **Set signing secret** on the Trigger.dev endpoint.
|
|
41
|
+
4. Send a test event from ElevenLabs, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Firecrawl webhooks"
|
|
3
|
+
sidebarTitle: "Firecrawl"
|
|
4
|
+
description: "Receive and verify Firecrawl webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-firecrawl-signature and run a task for each Firecrawl event, filtered on event.type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.firecrawl()` verifies the HMAC-SHA256 signature Firecrawl sends in `x-firecrawl-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/firecrawl.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const firecrawl = webhooks.endpoint.define({
|
|
13
|
+
id: "firecrawl",
|
|
14
|
+
source: webhooks.firecrawl(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const firecrawlEvents = webhook({
|
|
18
|
+
id: "firecrawl-events",
|
|
19
|
+
endpoint: firecrawl,
|
|
20
|
+
filter: "event.type == 'crawl.completed'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.firecrawl()` |
|
|
30
|
+
| Verification | HMAC-SHA256 in `x-firecrawl-signature` |
|
|
31
|
+
| Credential | Signing secret issued by Firecrawl |
|
|
32
|
+
| Event type | `event.type` |
|
|
33
|
+
| Firecrawl docs | [Firecrawl webhook docs](https://docs.firecrawl.dev/webhooks/overview) |
|
|
34
|
+
|
|
35
|
+
## Set up Firecrawl
|
|
36
|
+
|
|
37
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
38
|
+
2. Copy the webhook secret from the **Advanced** tab of your Firecrawl account settings. It is one secret for the whole account.
|
|
39
|
+
3. Choose **Set signing secret** on the Trigger.dev endpoint and paste it.
|
|
40
|
+
4. Firecrawl has no webhook settings page. Pass a `webhook` object with the URL and events on each crawl, batch scrape, extract or agent request instead:
|
|
41
|
+
|
|
42
|
+
```ts Your crawl code
|
|
43
|
+
await firecrawl.crawl("https://example.com", {
|
|
44
|
+
webhook: {
|
|
45
|
+
url: "<webhook URL>",
|
|
46
|
+
events: ["started", "page", "completed"],
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
5. Start a crawl with the `webhook` object, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
51
|
+
|
|
52
|
+
## Example task
|
|
53
|
+
|
|
54
|
+
The [Firecrawl URL crawl example](/guides/examples/firecrawl-url-crawl) crawls a site from a task. Add the `webhook` object above to receive each page as a delivery.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "GitHub webhooks"
|
|
3
|
+
sidebarTitle: "GitHub"
|
|
4
|
+
description: "Receive and verify GitHub webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-hub-signature-256 and run a task for each GitHub event, filtered on header.x-github-event."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.github()` verifies the HMAC-SHA256 signature GitHub sends in `x-hub-signature-256` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/github.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const github = webhooks.endpoint.define({
|
|
13
|
+
id: "github",
|
|
14
|
+
source: webhooks.github(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const githubEvents = webhook({
|
|
18
|
+
id: "github-events",
|
|
19
|
+
endpoint: github,
|
|
20
|
+
filter: "header.x-github-event == 'issues'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.github()` |
|
|
30
|
+
| Verification | HMAC-SHA256 in `x-hub-signature-256` |
|
|
31
|
+
| Credential | Secret you generate on Trigger.dev |
|
|
32
|
+
| Event type | `header.x-github-event` |
|
|
33
|
+
| GitHub docs | [GitHub webhook docs](https://docs.github.com/en/webhooks/using-webhooks/validating-webhook-deliveries) |
|
|
34
|
+
|
|
35
|
+
## Set up GitHub
|
|
36
|
+
|
|
37
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
38
|
+
2. Choose **Generate secret** on the Trigger.dev endpoint and copy the value. GitHub accepts a secret you choose.
|
|
39
|
+
3. Create the webhook. For a repository webhook with the `gh` CLI:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
gh api repos/OWNER/REPO/hooks -f name=web -f "config[url]=<webhook URL>" -f "config[content_type]=json" -f "config[secret]=<secret>" -f "events[]=issues" -F active=true
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Use `orgs/ORG/hooks` for an organization webhook. For a GitHub App, set the webhook URL and secret in the app's settings. Set the content type to `json`.
|
|
46
|
+
4. Trigger an event in the repository, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "GitLab webhooks"
|
|
3
|
+
sidebarTitle: "GitLab"
|
|
4
|
+
description: "Receive and verify GitLab webhooks with Trigger.dev. Check the secret token in x-gitlab-token and run a task for each GitLab event."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.gitlab()` checks the secret token GitLab sends in `x-gitlab-token` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/gitlab.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const gitlab = webhooks.endpoint.define({
|
|
13
|
+
id: "gitlab",
|
|
14
|
+
source: webhooks.gitlab(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const gitlabEvents = webhook({
|
|
18
|
+
id: "gitlab-events",
|
|
19
|
+
endpoint: gitlab,
|
|
20
|
+
onEvent: async ({ event }) => {
|
|
21
|
+
console.log(event);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To run a subscriber only for some events, add a [filter](/webhooks/filters) on `header.x-gitlab-event`.
|
|
27
|
+
|
|
28
|
+
| Setting | Value |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Source | `webhooks.gitlab()` |
|
|
31
|
+
| Verification | Shared secret in `x-gitlab-token` |
|
|
32
|
+
| Credential | Secret you generate on Trigger.dev |
|
|
33
|
+
| Event type | `header.x-gitlab-event` |
|
|
34
|
+
| GitLab docs | [GitLab webhook docs](https://docs.gitlab.com/user/project/integrations/webhooks/) |
|
|
35
|
+
|
|
36
|
+
## Set up GitLab
|
|
37
|
+
|
|
38
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
39
|
+
2. Choose **Generate secret** on the Trigger.dev endpoint and copy the value.
|
|
40
|
+
3. In the GitLab project or group, go to **Settings > Webhooks** and add a webhook with the webhook URL. Paste the secret into **Secret token** and select the triggers your subscribers need. GitLab sends the event name in the `x-gitlab-event` header.
|
|
41
|
+
4. Send a test event from GitLab, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Granola webhooks"
|
|
3
|
+
sidebarTitle: "Granola"
|
|
4
|
+
description: "Receive and verify Granola webhooks with Trigger.dev. Check the Standard Webhooks signature and run a task for each Granola event, filtered on event.event_type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.granola()` verifies the Standard Webhooks signature Granola sends in the `webhook-*` headers on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/granola.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const granola = webhooks.endpoint.define({
|
|
13
|
+
id: "granola",
|
|
14
|
+
source: webhooks.granola(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const granolaEvents = webhook({
|
|
18
|
+
id: "granola-events",
|
|
19
|
+
endpoint: granola,
|
|
20
|
+
filter: "event.event_type == 'note.generated'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.granola()` |
|
|
30
|
+
| Verification | Standard Webhooks (`webhook-id`, `webhook-timestamp`, `webhook-signature`) |
|
|
31
|
+
| Credential | Signing secret issued by Granola |
|
|
32
|
+
| Event type | `event.event_type` |
|
|
33
|
+
| Granola docs | [Granola webhook docs](https://docs.granola.ai/webhooks) |
|
|
34
|
+
|
|
35
|
+
## Set up Granola
|
|
36
|
+
|
|
37
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
38
|
+
2. Create the endpoint in Granola under **Settings > Connectors > Webhooks**, or under a folder's **Integrations > Webhooks** to limit it to that folder. Granola webhooks need a Business or Enterprise plan.
|
|
39
|
+
3. Granola shows the signing secret (it starts with `whsec_`) once, when the endpoint is created. Choose **Set signing secret** on the Trigger.dev endpoint and paste it.
|
|
40
|
+
4. Send a test event from Granola, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
41
|
+
|
|
42
|
+
## Fetching the note
|
|
43
|
+
|
|
44
|
+
Deliveries carry the note id but not its content. Fetch the note with Granola's API inside `onEvent`.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Hookdeck webhooks"
|
|
3
|
+
sidebarTitle: "Hookdeck"
|
|
4
|
+
description: "Receive webhooks that Hookdeck forwards from any provider. Check the HMAC-SHA256 signature in x-hookdeck-signature and run a Trigger.dev task for each event."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.hookdeck()` verifies requests that a Hookdeck connection forwards, so you can put Hookdeck in front of any provider.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/hookdeck.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const hookdeck = webhooks.endpoint.define({
|
|
13
|
+
id: "hookdeck",
|
|
14
|
+
source: webhooks.hookdeck(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const hookdeckEvents = webhook({
|
|
18
|
+
id: "hookdeck-events",
|
|
19
|
+
endpoint: hookdeck,
|
|
20
|
+
onEvent: async ({ event }) => {
|
|
21
|
+
console.log(event);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
| Setting | Value |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| Source | `webhooks.hookdeck()` |
|
|
29
|
+
| Verification | HMAC-SHA256 in `x-hookdeck-signature` |
|
|
30
|
+
| Credential | Signing secret issued by Hookdeck |
|
|
31
|
+
| Event type | The original provider's field, for example `event.type` for Stripe |
|
|
32
|
+
| Hookdeck docs | [Hookdeck webhook docs](https://hookdeck.com/docs/authentication) |
|
|
33
|
+
|
|
34
|
+
## Set up Hookdeck
|
|
35
|
+
|
|
36
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
37
|
+
2. In Hookdeck, create a connection whose destination is an HTTP destination with the webhook URL. Keep the destination's authentication on **Hookdeck Signature** (the default); Hookdeck only signs requests with it set.
|
|
38
|
+
3. Copy the project's signing secret from [**Settings > Secrets**](https://dashboard.hookdeck.com/settings/project/secrets), then choose **Set signing secret** on the Trigger.dev endpoint. It is one secret for the whole project.
|
|
39
|
+
4. Send a test event from Hookdeck, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
40
|
+
|
|
41
|
+
## Typing the event
|
|
42
|
+
|
|
43
|
+
Hookdeck forwards the original provider's body unchanged, so pass that provider's event type:
|
|
44
|
+
|
|
45
|
+
```ts /trigger/stripe-via-hookdeck.ts
|
|
46
|
+
import type Stripe from "stripe";
|
|
47
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
48
|
+
|
|
49
|
+
export const stripeViaHookdeck = webhooks.endpoint.define({
|
|
50
|
+
id: "stripe-via-hookdeck",
|
|
51
|
+
source: webhooks.hookdeck<Stripe.Event>(),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const paymentSucceeded = webhook({
|
|
55
|
+
id: "payment-succeeded",
|
|
56
|
+
endpoint: stripeViaHookdeck,
|
|
57
|
+
filter: "event.type == 'payment_intent.succeeded'",
|
|
58
|
+
onEvent: async ({ event }) => {
|
|
59
|
+
console.log(event.id);
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Rotation, deduplication and header prefix
|
|
65
|
+
|
|
66
|
+
- **Secret rotation:** when you roll the signing secret in Hookdeck with an expiry, Hookdeck also signs each request with the previous secret in `X-Hookdeck-Signature-2`, so deliveries keep verifying until you store the new secret.
|
|
67
|
+
- **Deduplication:** retries dedupe on `X-Hookdeck-Eventid`, which is the same on every attempt of a Hookdeck event.
|
|
68
|
+
- **Custom header prefix:** if you changed the header prefix in the Hookdeck project's settings, pass it with `webhooks.hookdeck({ headerPrefix: "x-acme" })`. The prefix renames the event id header; the signature headers keep the `X-Hookdeck-` name.
|
|
69
|
+
|
|
70
|
+
## Trigger a task through the API instead
|
|
71
|
+
|
|
72
|
+
You can also point a Hookdeck destination at the [trigger task API](/management/tasks/trigger) without a hosted endpoint. Hookdeck authenticates with your API key instead of a signature, and a transformation wraps the body in the `payload` field the API expects.
|
|
73
|
+
|
|
74
|
+
1. Create a destination with the URL `https://api.trigger.dev/api/v1/tasks/<task-id>/trigger`, method `POST`, and **Bearer token** authentication using a [**Trigger only**](/apikeys) environment API key.
|
|
75
|
+
2. Add a [transformation](https://hookdeck.com/docs/transformations):
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
addHandler("transform", (request, context) => {
|
|
79
|
+
request.body = { payload: request.body };
|
|
80
|
+
request.headers["content-type"] = "application/json";
|
|
81
|
+
return request;
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
3. Create a connection from your source to that destination and transformation. Turn on authentication for the Hookdeck source, such as the provider's signature verification: the destination's API key only authenticates Hookdeck to Trigger.dev, so an unauthenticated source would forward anyone's requests.
|
|
86
|
+
|
|
87
|
+
```ts /trigger/webhook-handler.ts
|
|
88
|
+
import { task } from "@trigger.dev/sdk";
|
|
89
|
+
|
|
90
|
+
export const webhookHandler = task({
|
|
91
|
+
id: "webhook-handler",
|
|
92
|
+
run: async (payload: unknown) => {
|
|
93
|
+
console.log("Received webhook:", payload);
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
This path doesn't deduplicate Hookdeck retries, so each forwarded request starts a run, and the delivery isn't recorded on a Trigger.dev endpoint.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Infisical webhooks"
|
|
3
|
+
sidebarTitle: "Infisical"
|
|
4
|
+
description: "Receive and verify Infisical webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-infisical-signature and run a task for each Infisical event, filtered on event.event."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.infisical()` verifies the HMAC-SHA256 signature Infisical sends in `x-infisical-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/infisical.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const infisical = webhooks.endpoint.define({
|
|
13
|
+
id: "infisical",
|
|
14
|
+
source: webhooks.infisical(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const infisicalEvents = webhook({
|
|
18
|
+
id: "infisical-events",
|
|
19
|
+
endpoint: infisical,
|
|
20
|
+
filter: "event.event == 'secrets.modified'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.infisical()` |
|
|
30
|
+
| Verification | HMAC-SHA256 in `x-infisical-signature` |
|
|
31
|
+
| Credential | Secret you generate on Trigger.dev |
|
|
32
|
+
| Event type | `event.event` |
|
|
33
|
+
| Infisical docs | [Infisical webhook docs](https://infisical.com/docs/documentation/platform/webhooks) |
|
|
34
|
+
|
|
35
|
+
## Set up Infisical
|
|
36
|
+
|
|
37
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
38
|
+
2. Choose **Generate secret** on the Trigger.dev endpoint and copy the value.
|
|
39
|
+
3. In Infisical, go to **Project Settings > Webhooks** and create a **General** webhook with the webhook URL. Optionally limit it to an environment and secret path.
|
|
40
|
+
4. Paste the secret into the webhook's secret key field. The secret is required: Infisical only signs webhooks that have one, and the endpoint rejects unsigned deliveries.
|
|
41
|
+
5. Send a test event from Infisical, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|