Skip to content

Commit 73e592b

Browse files
committed
docs(webhooks): make example snippets self-contained with imports
Several webhook doc code blocks used webhook, webhooks, streamText, anthropic, or chat without importing them, so a copied snippet would not type-check on its own. Add the imports to the standalone examples across sources, filters, channels, and human-in-the-loop.
1 parent 997aeb2 commit 73e592b

4 files changed

Lines changed: 13 additions & 0 deletions

File tree

docs/webhooks/channels.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ List channels on a [`chat.agent`](/ai-chat/overview) alongside (or instead of) `
1111
```ts
1212
import { chat } from "@trigger.dev/sdk/ai";
1313
import { slack } from "@trigger.dev/slack";
14+
import { streamText } from "ai";
15+
import { anthropic } from "@ai-sdk/anthropic";
1416

1517
export const supportAgent = chat.agent({
1618
id: "support-agent",

docs/webhooks/filters.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ The type checker reads the filter as a token stream, so a couple of spots are st
8686
To match only certain event types, write a clause against the field that carries the type: `event.type` for Stripe / Svix / Square / Discord, or the `x-github-event` header for GitHub (the filter DSL can read a `header.` namespace too):
8787

8888
```ts
89+
import { webhook, webhooks } from "@trigger.dev/sdk";
90+
8991
export const onGithub = webhook({
9092
id: "github",
9193
source: webhooks.github(),

docs/webhooks/human-in-the-loop.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ For [`chat.channels.custom`](/webhooks/channels), or to override the Slack defau
9999
Slack encodes the decision in each button's `value` as `${toolCallId}::approve|deny` so `onInteraction` can resolve the exact call, and `finalizeInteraction` posts to the interaction's `response_url` with `replace_original` to swap the buttons for the outcome. On a custom surface you choose the encoding and how you edit the controls away.
100100

101101
```ts
102+
import { chat } from "@trigger.dev/sdk/ai";
103+
import { webhooks } from "@trigger.dev/sdk";
104+
102105
chat.channels.custom({
103106
id: "my-surface",
104107
source: webhooks.custom<MyEvent>({ /* verifier config */ }),

docs/webhooks/sources.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export const stripeWebhook = webhook({
2727
```
2828

2929
```ts GitHub
30+
import { webhook, webhooks } from "@trigger.dev/sdk";
31+
3032
export const githubWebhook = webhook({
3133
id: "github",
3234
source: webhooks.github(),
@@ -38,6 +40,8 @@ export const githubWebhook = webhook({
3840
```
3941

4042
```ts Svix
43+
import { webhook, webhooks } from "@trigger.dev/sdk";
44+
4145
// Also covers Clerk, Resend, and other Svix-powered providers
4246
export const svixWebhook = webhook({
4347
id: "svix",
@@ -57,6 +61,8 @@ The available presets are `stripe()`, `github()`, `svix()`, `square()`, and `dis
5761
For a provider without a preset, `webhooks.custom()` describes the scheme as data. For example, an HMAC-SHA256 signature over the raw body, in a custom header:
5862

5963
```ts
64+
import { webhook, webhooks } from "@trigger.dev/sdk";
65+
6066
export const customWebhook = webhook({
6167
id: "custom",
6268
source: webhooks.custom<{ id: string; message: string }>({

0 commit comments

Comments
 (0)