|
| 1 | +--- |
| 2 | +title: Webhook |
| 3 | +--- |
| 4 | + |
| 5 | +import { Callout } from 'fumadocs-ui/components/callout' |
| 6 | +import { Image } from '@/components/ui/image' |
| 7 | + |
| 8 | +The Webhook block sends HTTP POST requests to external webhook endpoints with automatic webhook headers and optional HMAC signing. |
| 9 | + |
| 10 | +<div className="flex justify-center"> |
| 11 | + <Image |
| 12 | + src="/static/blocks/webhook.png" |
| 13 | + alt="Webhook Block" |
| 14 | + width={500} |
| 15 | + height={400} |
| 16 | + className="my-6" |
| 17 | + /> |
| 18 | +</div> |
| 19 | + |
| 20 | +## Configuration |
| 21 | + |
| 22 | +### Webhook URL |
| 23 | + |
| 24 | +The destination endpoint for your webhook request. Supports both static URLs and dynamic values from other blocks. |
| 25 | + |
| 26 | +### Payload |
| 27 | + |
| 28 | +JSON data to send in the request body. Use the AI wand to generate payloads or reference workflow variables: |
| 29 | + |
| 30 | +```json |
| 31 | +{ |
| 32 | + "event": "workflow.completed", |
| 33 | + "data": { |
| 34 | + "result": "<agent.content>", |
| 35 | + "timestamp": "<function.result>" |
| 36 | + } |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +### Signing Secret |
| 41 | + |
| 42 | +Optional secret for HMAC-SHA256 payload signing. When provided, the block adds an `X-Webhook-Signature` header: |
| 43 | + |
| 44 | +``` |
| 45 | +X-Webhook-Signature: t=1234567890,v1=abc123... |
| 46 | +``` |
| 47 | + |
| 48 | +Verify signatures by computing `HMAC-SHA256(secret, "${timestamp}.${body}")`. |
| 49 | + |
| 50 | +### Additional Headers |
| 51 | + |
| 52 | +Custom headers to include with the request. User-provided headers override automatic webhook headers. |
| 53 | + |
| 54 | +## Automatic Headers |
| 55 | + |
| 56 | +Every request includes: |
| 57 | + |
| 58 | +| Header | Description | |
| 59 | +|--------|-------------| |
| 60 | +| `Content-Type` | `application/json` | |
| 61 | +| `X-Webhook-Timestamp` | Unix timestamp (milliseconds) | |
| 62 | +| `X-Delivery-ID` | Unique delivery identifier (UUID) | |
| 63 | +| `Idempotency-Key` | Same as delivery ID for deduplication | |
| 64 | + |
| 65 | +## Outputs |
| 66 | + |
| 67 | +| Output | Type | Description | |
| 68 | +|--------|------|-------------| |
| 69 | +| `data` | json | Response body from the endpoint | |
| 70 | +| `status` | number | HTTP status code | |
| 71 | +| `headers` | json | Response headers | |
| 72 | + |
| 73 | +## Example Use Cases |
| 74 | + |
| 75 | +**Notify external services** - Send workflow results to Slack, Discord, or custom endpoints |
| 76 | +``` |
| 77 | +Agent → Function (format) → Webhook (notify) |
| 78 | +``` |
| 79 | + |
| 80 | +**Trigger external workflows** - Start processes in other systems when conditions are met |
| 81 | +``` |
| 82 | +Condition (check) → Webhook (trigger) → Response |
| 83 | +``` |
| 84 | + |
| 85 | +<Callout> |
| 86 | +The Webhook block always uses POST. For other HTTP methods or more control, use the [API block](/blocks/api). |
| 87 | +</Callout> |
0 commit comments