@trigger.dev/sdk 4.8.5 → 4.8.6
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 +29 -5
- package/dist/commonjs/v3/ai.js +160 -114
- 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 +35 -12
- 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/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 +29 -5
- package/dist/esm/v3/ai.js +162 -117
- 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 +34 -12
- 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/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 +38 -15
- 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 +21 -0
- 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,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "OpenAI webhooks"
|
|
3
|
+
sidebarTitle: "OpenAI"
|
|
4
|
+
description: "Receive and verify OpenAI webhooks with Trigger.dev. Check the Standard Webhooks signature and run a task for each OpenAI event, filtered on event.type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.openai()` verifies the Standard Webhooks signature OpenAI sends in the `webhook-*` headers on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/openai.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const openai = webhooks.endpoint.define({
|
|
13
|
+
id: "openai",
|
|
14
|
+
source: webhooks.openai(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const openaiEvents = webhook({
|
|
18
|
+
id: "openai-events",
|
|
19
|
+
endpoint: openai,
|
|
20
|
+
filter: "event.type == 'batch.completed'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.openai()` |
|
|
30
|
+
| Verification | Standard Webhooks (`webhook-id`, `webhook-timestamp`, `webhook-signature`) |
|
|
31
|
+
| Credential | Signing secret issued by OpenAI |
|
|
32
|
+
| Event type | `event.type` |
|
|
33
|
+
| OpenAI docs | [OpenAI webhook docs](https://developers.openai.com/api/docs/guides/webhooks) |
|
|
34
|
+
|
|
35
|
+
## Set up OpenAI
|
|
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 OpenAI'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 OpenAI, 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: "PagerDuty webhooks"
|
|
3
|
+
sidebarTitle: "PagerDuty"
|
|
4
|
+
description: "Receive and verify PagerDuty webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-pagerduty-signature and run a task for each PagerDuty event, filtered on event.event.event_type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.pagerduty()` verifies the HMAC-SHA256 signature PagerDuty sends in `x-pagerduty-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/pagerduty.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const pagerduty = webhooks.endpoint.define({
|
|
13
|
+
id: "pagerduty",
|
|
14
|
+
source: webhooks.pagerduty(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const pagerdutyEvents = webhook({
|
|
18
|
+
id: "pagerduty-events",
|
|
19
|
+
endpoint: pagerduty,
|
|
20
|
+
filter: "event.event.event_type == 'incident.triggered'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.pagerduty()` |
|
|
30
|
+
| Verification | HMAC-SHA256 in `x-pagerduty-signature` |
|
|
31
|
+
| Credential | Signing secret issued by PagerDuty |
|
|
32
|
+
| Event type | `event.event.event_type` |
|
|
33
|
+
| PagerDuty docs | [PagerDuty webhook docs](https://docs.pagerduty.com/developer/verifying-webhook-signatures) |
|
|
34
|
+
|
|
35
|
+
## Set up PagerDuty
|
|
36
|
+
|
|
37
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
38
|
+
2. In PagerDuty, open **Integrations > Generic Webhooks (v3)** and choose **New Webhook**. Enter the webhook URL and select the event types your subscribers need.
|
|
39
|
+
3. PagerDuty shows the webhook's signing secret once, when the webhook is created. Copy it then, and choose **Set signing secret** on the Trigger.dev endpoint.
|
|
40
|
+
4. Send a test event from PagerDuty, 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: "Plain webhooks"
|
|
3
|
+
sidebarTitle: "Plain"
|
|
4
|
+
description: "Receive and verify Plain webhooks with Trigger.dev. Check the HMAC-SHA256 signature in plain-request-signature and run a task for each Plain event, filtered on event.type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.plain()` verifies the HMAC-SHA256 signature Plain sends in `plain-request-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/plain.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const plain = webhooks.endpoint.define({
|
|
13
|
+
id: "plain",
|
|
14
|
+
source: webhooks.plain(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const plainEvents = webhook({
|
|
18
|
+
id: "plain-events",
|
|
19
|
+
endpoint: plain,
|
|
20
|
+
filter: "event.type == 'thread.thread_created'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.plain()` |
|
|
30
|
+
| Verification | HMAC-SHA256 in `plain-request-signature` |
|
|
31
|
+
| Credential | Signing secret issued by Plain |
|
|
32
|
+
| Event type | `event.type` |
|
|
33
|
+
| Plain docs | [Plain webhook docs](https://www.plain.com/docs/webhooks) |
|
|
34
|
+
|
|
35
|
+
## Set up Plain
|
|
36
|
+
|
|
37
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
38
|
+
2. As a workspace admin, view or generate the request signing secret under **Settings > Request signing**. It is one secret for the whole workspace, so read the existing one if other webhook targets use it.
|
|
39
|
+
3. Choose **Set signing secret** on the Trigger.dev endpoint and paste it.
|
|
40
|
+
4. Add the target under **Settings > Webhooks > Add webhook target**, with the webhook URL and the events your subscribers need.
|
|
41
|
+
5. Send a test event from Plain, 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: "PlanetScale webhooks"
|
|
3
|
+
sidebarTitle: "PlanetScale"
|
|
4
|
+
description: "Receive and verify PlanetScale webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-planetscale-signature and run a task for each PlanetScale event, filtered on event.event."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.planetscale()` verifies the HMAC-SHA256 signature PlanetScale sends in `x-planetscale-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/planetscale.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const planetscale = webhooks.endpoint.define({
|
|
13
|
+
id: "planetscale",
|
|
14
|
+
source: webhooks.planetscale(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const planetscaleEvents = webhook({
|
|
18
|
+
id: "planetscale-events",
|
|
19
|
+
endpoint: planetscale,
|
|
20
|
+
filter: "event.event == 'branch.ready'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.planetscale()` |
|
|
30
|
+
| Verification | HMAC-SHA256 in `x-planetscale-signature` |
|
|
31
|
+
| Credential | Signing secret issued by PlanetScale |
|
|
32
|
+
| Event type | `event.event` |
|
|
33
|
+
| PlanetScale docs | [PlanetScale webhook docs](https://planetscale.com/docs/api/webhooks) |
|
|
34
|
+
|
|
35
|
+
## Set up PlanetScale
|
|
36
|
+
|
|
37
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
38
|
+
2. Select the database in PlanetScale, then **Settings > Webhooks > Add webhook**. Enter the webhook URL and select the events your subscribers need. This needs the database administrator role.
|
|
39
|
+
3. In the webhook's menu, choose **Show secret**, copy it, and choose **Set signing secret** on the Trigger.dev endpoint.
|
|
40
|
+
4. Choose **Test webhook** in the same menu to send a `webhook.test` event, 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: "Recall.ai webhooks"
|
|
3
|
+
sidebarTitle: "Recall.ai"
|
|
4
|
+
description: "Receive and verify Recall.ai webhooks with Trigger.dev. Check the Standard Webhooks signature and run a task for each Recall.ai event, filtered on event.event."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.recallai()` verifies the Standard Webhooks signature Recall.ai sends in the `webhook-*` headers on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/recall-ai.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const recallai = webhooks.endpoint.define({
|
|
13
|
+
id: "recall-ai",
|
|
14
|
+
source: webhooks.recallai(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const recallaiEvents = webhook({
|
|
18
|
+
id: "recall-ai-events",
|
|
19
|
+
endpoint: recallai,
|
|
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.recallai()` |
|
|
31
|
+
| Verification | Standard Webhooks (`webhook-id`, `webhook-timestamp`, `webhook-signature`) |
|
|
32
|
+
| Credential | Workspace verification secret issued by Recall.ai |
|
|
33
|
+
| Event type | `event.event` |
|
|
34
|
+
| Recall.ai docs | [Recall.ai webhook docs](https://docs.recall.ai/docs/authenticating-requests-from-recallai) |
|
|
35
|
+
|
|
36
|
+
## Set up Recall.ai
|
|
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 an endpoint on Recall.ai's webhooks dashboard and subscribe it to the event types your subscribers need.
|
|
40
|
+
3. Create a workspace verification secret under **Developers > API Keys & Secrets > Create Workspace Secret**, then choose **Set signing secret** on the Trigger.dev endpoint and paste it. Recall.ai sends no signature headers until a workspace secret exists.
|
|
41
|
+
4. Send a test event from Recall.ai, 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
|
+
## Accounts created before 15 December 2025
|
|
44
|
+
|
|
45
|
+
Older Recall.ai accounts sign webhooks-dashboard deliveries with `svix-*` headers and a separate secret for each endpoint. For those accounts, declare the endpoint with `webhooks.svix()` instead, and set the endpoint's signing secret from the Recall.ai webhooks dashboard:
|
|
46
|
+
|
|
47
|
+
```ts /trigger/recall.ts
|
|
48
|
+
import { webhooks } from "@trigger.dev/sdk";
|
|
49
|
+
|
|
50
|
+
export const recall = webhooks.endpoint.define({
|
|
51
|
+
id: "recall",
|
|
52
|
+
source: webhooks.svix(),
|
|
53
|
+
});
|
|
54
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Replicate webhooks"
|
|
3
|
+
sidebarTitle: "Replicate"
|
|
4
|
+
description: "Receive and verify Replicate webhooks with Trigger.dev. Check the Standard Webhooks signature and run a task for each Replicate event, filtered on event.status."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.replicate()` verifies the Standard Webhooks signature Replicate sends in the `webhook-*` headers on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/replicate.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const replicate = webhooks.endpoint.define({
|
|
13
|
+
id: "replicate",
|
|
14
|
+
source: webhooks.replicate(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const replicateEvents = webhook({
|
|
18
|
+
id: "replicate-events",
|
|
19
|
+
endpoint: replicate,
|
|
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.status`.
|
|
27
|
+
|
|
28
|
+
| Setting | Value |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Source | `webhooks.replicate()` |
|
|
31
|
+
| Verification | Standard Webhooks (`webhook-id`, `webhook-timestamp`, `webhook-signature`) |
|
|
32
|
+
| Credential | Signing secret issued by Replicate |
|
|
33
|
+
| Event type | `event.status` |
|
|
34
|
+
| Replicate docs | [Replicate webhook docs](https://replicate.com/docs/topics/webhooks/verify-webhook) |
|
|
35
|
+
|
|
36
|
+
## Set up Replicate
|
|
37
|
+
|
|
38
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
39
|
+
2. Replicate has no webhook settings page. Pass the webhook URL as `webhook` when you create a prediction, with `webhook_events_filter` set to the events you want (`start`, `output`, `logs`, `completed`).
|
|
40
|
+
3. Get your signing secret from `GET https://api.replicate.com/v1/webhooks/default/secret`. It starts with `whsec_` and is the same for every webhook on your user or organization. Choose **Set signing secret** on the Trigger.dev endpoint and paste it.
|
|
41
|
+
4. Create a prediction with the webhook set, 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: "Resend webhooks"
|
|
3
|
+
sidebarTitle: "Resend"
|
|
4
|
+
description: "Receive and verify Resend webhooks with Trigger.dev. Check the Svix signature and run a task for each Resend event, filtered on event.type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.resend()` verifies the Svix signature Resend sends in the `svix-*` headers on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/resend.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const resend = webhooks.endpoint.define({
|
|
13
|
+
id: "resend",
|
|
14
|
+
source: webhooks.resend(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const resendEvents = webhook({
|
|
18
|
+
id: "resend-events",
|
|
19
|
+
endpoint: resend,
|
|
20
|
+
filter: "event.type == 'email.delivered'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.resend()` |
|
|
30
|
+
| Verification | Svix (`svix-id`, `svix-timestamp`, `svix-signature`) |
|
|
31
|
+
| Credential | Signing secret issued by Resend |
|
|
32
|
+
| Event type | `event.type` |
|
|
33
|
+
| Resend docs | [Resend webhook docs](https://resend.com/docs/webhooks/introduction) |
|
|
34
|
+
|
|
35
|
+
## Set up Resend
|
|
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 Resend'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 Resend, 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
|
+
## Example project
|
|
43
|
+
|
|
44
|
+
The [Resend email agent example](/guides/example-projects/resend-email-agent) drafts replies to a Resend inbox from these webhooks and waits for approval in Slack before sending.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Retell AI webhooks"
|
|
3
|
+
sidebarTitle: "Retell AI"
|
|
4
|
+
description: "Receive and verify Retell AI webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-retell-signature and run a task for each Retell AI event, filtered on event.event."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.retell()` verifies the HMAC-SHA256 signature Retell AI sends in `x-retell-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/retell.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const retell = webhooks.endpoint.define({
|
|
13
|
+
id: "retell",
|
|
14
|
+
source: webhooks.retell(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const retellEvents = webhook({
|
|
18
|
+
id: "retell-events",
|
|
19
|
+
endpoint: retell,
|
|
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.retell()` |
|
|
31
|
+
| Verification | HMAC-SHA256 in `x-retell-signature` |
|
|
32
|
+
| Credential | The Retell AI API key with the webhook badge |
|
|
33
|
+
| Event type | `event.event` |
|
|
34
|
+
| Retell AI docs | [Retell AI webhook docs](https://docs.retellai.com/features/secure-webhook) |
|
|
35
|
+
|
|
36
|
+
## Set up Retell AI
|
|
37
|
+
|
|
38
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
39
|
+
2. In Retell AI, set the webhook URL as the account-level webhook in the system settings' **Webhooks** tab, or as an agent's **Agent Level Webhook URL** under **Webhook settings** in the agent editor. An agent-level URL replaces the account-level one for that agent.
|
|
40
|
+
3. Retell AI signs with an API key, not a per-webhook secret. Copy the API key that has the webhook badge next to it, then choose **Set signing secret** on the Trigger.dev endpoint and paste it.
|
|
41
|
+
4. Send a test event from Retell AI, 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: "Sentry webhooks"
|
|
3
|
+
sidebarTitle: "Sentry"
|
|
4
|
+
description: "Receive and verify Sentry webhooks with Trigger.dev. Check the HMAC-SHA256 signature in sentry-hook-signature and run a task for each Sentry event, filtered on header.sentry-hook-resource."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.sentry()` verifies the HMAC-SHA256 signature Sentry sends in `sentry-hook-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/sentry.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const sentry = webhooks.endpoint.define({
|
|
13
|
+
id: "sentry",
|
|
14
|
+
source: webhooks.sentry(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const sentryEvents = webhook({
|
|
18
|
+
id: "sentry-events",
|
|
19
|
+
endpoint: sentry,
|
|
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.sentry-hook-resource`.
|
|
27
|
+
|
|
28
|
+
| Setting | Value |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Source | `webhooks.sentry()` |
|
|
31
|
+
| Verification | HMAC-SHA256 in `sentry-hook-signature` |
|
|
32
|
+
| Credential | The integration's Client Secret, issued by Sentry |
|
|
33
|
+
| Event type | `header.sentry-hook-resource` |
|
|
34
|
+
| Sentry docs | [Sentry webhook docs](https://docs.sentry.io/integrations/integration-platform/webhooks/) |
|
|
35
|
+
|
|
36
|
+
## Set up Sentry
|
|
37
|
+
|
|
38
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
39
|
+
2. In Sentry, open **Settings > Developer Settings > Custom Integrations** and create an internal integration. Set its **Webhook URL** to the webhook URL, turn on alert rule action if you want alerts, and enable the resource types (such as issue, error or comment) your subscribers need.
|
|
40
|
+
3. Sentry signs webhooks with the integration's **Client Secret**. Copy it from the integration's page, then choose **Set signing secret** on the Trigger.dev endpoint.
|
|
41
|
+
4. Send a test event from Sentry, 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,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Shopify webhooks"
|
|
3
|
+
sidebarTitle: "Shopify"
|
|
4
|
+
description: "Receive and verify Shopify webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-shopify-hmac-sha256 and run a task for each Shopify event, filtered on header.x-shopify-topic."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.shopify()` verifies the HMAC-SHA256 signature Shopify sends in `x-shopify-hmac-sha256` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/shopify.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const shopify = webhooks.endpoint.define({
|
|
13
|
+
id: "shopify",
|
|
14
|
+
source: webhooks.shopify(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const shopifyEvents = webhook({
|
|
18
|
+
id: "shopify-events",
|
|
19
|
+
endpoint: shopify,
|
|
20
|
+
filter: "header.x-shopify-topic == 'orders/create'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.shopify()` |
|
|
30
|
+
| Verification | HMAC-SHA256 in `x-shopify-hmac-sha256` |
|
|
31
|
+
| Credential | Signing secret issued by Shopify |
|
|
32
|
+
| Event type | `header.x-shopify-topic` |
|
|
33
|
+
| Shopify docs | [Shopify webhook docs](https://shopify.dev/docs/apps/build/webhooks/verify-deliveries) |
|
|
34
|
+
|
|
35
|
+
## Set up Shopify
|
|
36
|
+
|
|
37
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
38
|
+
2. For an app, add a subscription to `shopify.app.toml` and run `shopify app deploy`:
|
|
39
|
+
|
|
40
|
+
```toml shopify.app.toml
|
|
41
|
+
[[webhooks.subscriptions]]
|
|
42
|
+
topics = ["orders/create"]
|
|
43
|
+
uri = "<webhook URL>"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or create it with the Admin API's `webhookSubscriptionCreate` mutation. Use the JSON format.
|
|
47
|
+
3. Shopify signs app webhooks with the app's client secret, which is in the app's settings in the Shopify Dev Dashboard. Choose **Set signing secret** on the Trigger.dev endpoint and paste it.
|
|
48
|
+
4. For a store without an app, add the webhook under **Settings > Notifications > Webhooks** in the store admin, and use the signing key shown on that page instead.
|
|
49
|
+
5. Send a test event from Shopify, 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,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Slack webhooks"
|
|
3
|
+
sidebarTitle: "Slack"
|
|
4
|
+
description: "Receive and verify Slack webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-slack-signature and run a task for each Slack event, filtered on event.event.type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhookSource()` from `@trigger.dev/slack` verifies the HMAC-SHA256 signature Slack sends in `x-slack-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/slack.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
import { webhookSource } from "@trigger.dev/slack";
|
|
12
|
+
|
|
13
|
+
export const slack = webhooks.endpoint.define({
|
|
14
|
+
id: "slack",
|
|
15
|
+
source: webhookSource(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const slackEvents = webhook({
|
|
19
|
+
id: "slack-events",
|
|
20
|
+
endpoint: slack,
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
To run a subscriber only for some events, add a [filter](/webhooks/filters) on `event.event.type`.
|
|
28
|
+
|
|
29
|
+
| Setting | Value |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| Source | `webhookSource()` from `@trigger.dev/slack` |
|
|
32
|
+
| Verification | HMAC-SHA256 in `x-slack-signature`, with a timestamp tolerance |
|
|
33
|
+
| Credential | Signing secret issued by Slack |
|
|
34
|
+
| Event type | `event.event.type` |
|
|
35
|
+
| Slack docs | [Slack webhook docs](https://docs.slack.dev/authentication/verifying-requests-from-slack/) |
|
|
36
|
+
|
|
37
|
+
## Set up Slack
|
|
38
|
+
|
|
39
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
40
|
+
2. In your Slack app's settings, set the **Event Subscriptions** request URL to the webhook URL and subscribe to the bot events your subscribers need.
|
|
41
|
+
3. Copy the app's **Signing Secret** from **Basic Information > App Credentials**, then choose **Set signing secret** on the Trigger.dev endpoint.
|
|
42
|
+
4. Back on the Event Subscriptions page, choose **Retry**. Slack's `url_verification` challenge is answered by the endpoint once the secret is set.
|
|
43
|
+
5. Install the app to your workspace, or reinstall it if the bot events need new scopes. Slack only delivers events the workspace has authorized.
|
|
44
|
+
6. Send a test event from Slack, 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.
|
|
45
|
+
|
|
46
|
+
## Build a Slack agent
|
|
47
|
+
|
|
48
|
+
To answer messages in Slack with a `chat.agent`, use the `slack()` connector on the same endpoint. It handles streaming replies, status updates and approvals. See [Slack agents](/webhooks/slack).
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Square webhooks"
|
|
3
|
+
sidebarTitle: "Square"
|
|
4
|
+
description: "Receive and verify Square webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-square-hmacsha256-signature and run a task for each Square event, filtered on event.type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.square()` verifies the HMAC-SHA256 signature Square sends in `x-square-hmacsha256-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/square.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const square = webhooks.endpoint.define({
|
|
13
|
+
id: "square",
|
|
14
|
+
source: webhooks.square(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const squareEvents = webhook({
|
|
18
|
+
id: "square-events",
|
|
19
|
+
endpoint: square,
|
|
20
|
+
filter: "event.type == 'payment.created'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.square()` |
|
|
30
|
+
| Verification | HMAC-SHA256 in `x-square-hmacsha256-signature` |
|
|
31
|
+
| Credential | Signing secret issued by Square |
|
|
32
|
+
| Event type | `event.type` |
|
|
33
|
+
| Square docs | [Square webhook docs](https://developer.squareup.com/docs/webhooks/step3validate) |
|
|
34
|
+
|
|
35
|
+
## Set up Square
|
|
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 a webhook in Square and select the events your subscribers need. See Square's [webhook docs](https://developer.squareup.com/docs/webhooks/step3validate) for where its webhook settings are.
|
|
39
|
+
3. Copy the signing secret Square shows for the webhook, then choose **Set signing secret** on the Trigger.dev endpoint.
|
|
40
|
+
4. Send a test event from Square, 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,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Receive and verify Stripe webhooks"
|
|
3
|
+
sidebarTitle: "Stripe"
|
|
4
|
+
description: "Verify Stripe's webhook signature and run a Trigger.dev task for each Stripe event, such as checkout.session.completed. Register the endpoint in Stripe, set the whsec_ signing secret, and filter by event type."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.stripe()` verifies the HMAC-SHA256 signature Stripe sends in `stripe-signature` on every request.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/stripe.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const stripe = webhooks.endpoint.define({
|
|
13
|
+
id: "stripe",
|
|
14
|
+
source: webhooks.stripe(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const fulfillCheckout = webhook({
|
|
18
|
+
id: "fulfill-checkout",
|
|
19
|
+
endpoint: stripe,
|
|
20
|
+
filter: "event.type == 'checkout.session.completed'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log("Checkout completed", event.data.object.id);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.stripe()` |
|
|
30
|
+
| Verification | HMAC-SHA256 in `stripe-signature`, with a timestamp tolerance |
|
|
31
|
+
| Credential | Signing secret issued by Stripe (starts with `whsec_`) |
|
|
32
|
+
| Event type | `event.type` |
|
|
33
|
+
| Stripe docs | [Stripe webhook docs](https://docs.stripe.com/webhooks) |
|
|
34
|
+
|
|
35
|
+
## Set up Stripe
|
|
36
|
+
|
|
37
|
+
1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
|
|
38
|
+
2. In the Stripe Dashboard, open the **Webhooks** tab in Workbench and choose **Create an event destination**. Choose the **Snapshot** payload format, select the events you want, choose **Webhook endpoint** and paste the Webhook URL.
|
|
39
|
+
3. On the destination's settings page, choose **Reveal secret** and copy the signing secret.
|
|
40
|
+
4. Choose **Set signing secret** on the Trigger.dev endpoint and paste the secret.
|
|
41
|
+
5. Use a test mode destination for dev and staging environments and a live mode destination for production. Each has its own signing secret.
|
|
42
|
+
|
|
43
|
+
To create the destination from the Stripe CLI instead, the response's `secret` field is the signing secret:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
stripe webhook_endpoints create -d url="<webhook URL>" -d "enabled_events[]=checkout.session.completed"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Test locally
|
|
50
|
+
|
|
51
|
+
Your dev environment has its own Webhook URL, so you don't need `stripe listen` or a tunnel. With `trigger dev` running and a test mode destination pointing at the dev URL, send a test event with the Stripe CLI:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
stripe trigger checkout.session.completed
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The delivery appears on the endpoint's **Deliveries** tab with a link to the run it started. You can also send a sample event from the endpoint's **Test** tab. See [Verify the connection](/webhooks/connect#verify-the-connection) if nothing arrives.
|
|
58
|
+
|
|
59
|
+
## Typing the event
|
|
60
|
+
|
|
61
|
+
`webhooks.stripe()` provides a default event shape. For the full Stripe types, install the `stripe` package and pass `Stripe.Event`:
|
|
62
|
+
|
|
63
|
+
```ts /trigger/stripe.ts
|
|
64
|
+
import type Stripe from "stripe";
|
|
65
|
+
import { webhooks } from "@trigger.dev/sdk";
|
|
66
|
+
|
|
67
|
+
export const stripe = webhooks.endpoint.define({
|
|
68
|
+
id: "stripe",
|
|
69
|
+
source: webhooks.stripe<Stripe.Event>(),
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Handle Stripe webhooks in your own route
|
|
74
|
+
|
|
75
|
+
If you already receive Stripe webhooks in your app, verify them with `stripe.webhooks.constructEvent()` and trigger a task from the route with `tasks.trigger()`. See [Use your own webhook handler](/webhooks/own-handler) for a Next.js example.
|
|
76
|
+
|
|
77
|
+
## Next steps
|
|
78
|
+
|
|
79
|
+
<CardGroup cols={2}>
|
|
80
|
+
<Card title="Filters" icon="filter" href="/webhooks/filters">
|
|
81
|
+
Run each subscriber only for the Stripe events it handles.
|
|
82
|
+
</Card>
|
|
83
|
+
<Card title="Waiters" icon="hourglass" href="/webhooks/waiters">
|
|
84
|
+
Pause a run until a matching Stripe event arrives.
|
|
85
|
+
</Card>
|
|
86
|
+
</CardGroup>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Supabase webhooks"
|
|
3
|
+
sidebarTitle: "Supabase"
|
|
4
|
+
description: "Receive Supabase database webhooks with Trigger.dev. Check a shared bearer secret and run a task for each insert, update or delete."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**`webhooks.supabase()` checks a shared secret on every request, because Supabase database webhooks aren't signed.**
|
|
8
|
+
|
|
9
|
+
```ts /trigger/supabase.ts
|
|
10
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
11
|
+
|
|
12
|
+
export const supabase = webhooks.endpoint.define({
|
|
13
|
+
id: "supabase",
|
|
14
|
+
source: webhooks.supabase(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const supabaseEvents = webhook({
|
|
18
|
+
id: "supabase-events",
|
|
19
|
+
endpoint: supabase,
|
|
20
|
+
filter: "event.type == 'INSERT' && event.table == 'orders'",
|
|
21
|
+
onEvent: async ({ event }) => {
|
|
22
|
+
console.log(event);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Value |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Source | `webhooks.supabase()` |
|
|
30
|
+
| Verification | Shared secret as `Authorization: Bearer` |
|
|
31
|
+
| Credential | Secret you generate on Trigger.dev |
|
|
32
|
+
| Event type | `event.type` |
|
|
33
|
+
| Supabase docs | [Supabase webhook docs](https://supabase.com/docs/guides/database/webhooks) |
|
|
34
|
+
|
|
35
|
+
## Set up Supabase
|
|
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. Supabase database webhooks aren't signed, so the endpoint checks this shared secret instead.
|
|
39
|
+
3. On the **Database Webhooks** page of the Supabase dashboard, create a webhook on the table and events (`INSERT`, `UPDATE`, `DELETE`) your subscribers need, with type **HTTP Request**, method `POST`, and the webhook URL.
|
|
40
|
+
4. Under **HTTP Headers**, add `Authorization` with the value `Bearer <secret>`.
|
|
41
|
+
5. Insert a row into the table, 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.
|