Skip to content

Commit eebd7e3

Browse files
docs: document webhook response toggle and triggering event context properties
- Add Return Event as Response Payload toggle documentation to webhooks page - Add triggering_event_id and triggering_event_key properties to Python Context reference - Add triggeringEventId() and triggeringEventKey() methods to TypeScript Context reference Related to PR hatchet-dev#3625
1 parent 9e4e5c7 commit eebd7e3

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

frontend/docs/pages/reference/python/context.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,26 @@ Returns:
132132
| ------------- | --------------------------------------------------------- |
133133
| `str \| None` | The id of the workflow version that this task belongs to. |
134134

135+
#### `triggering_event_id`
136+
137+
The external ID of the event that triggered this workflow run, if any. Useful for correlating tasks back to the originating event when your workflow was triggered by an [event](/v1/external-events/run-on-event) or [webhook](/v1/webhooks).
138+
139+
Returns:
140+
141+
| Type | Description |
142+
| ------------- | ---------------------------------------------------------------------------------------- |
143+
| `str \| None` | The external ID of the triggering event, or None if the workflow was not event-triggered. |
144+
145+
#### `triggering_event_key`
146+
147+
The key of the event that triggered this workflow run, if any. This corresponds to the event key used when the event was pushed or generated by a webhook.
148+
149+
Returns:
150+
151+
| Type | Description |
152+
| ------------- | ----------------------------------------------------------------------------------- |
153+
| `str \| None` | The key of the triggering event, or None if the workflow was not event-triggered. |
154+
135155
#### `task_run_errors`
136156

137157
A helper intended to be used in an on-failure step to retrieve the errors that occurred in upstream task runs.

frontend/docs/pages/reference/typescript/Context.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,30 @@ Returns
308308

309309
True if the workflow was triggered by an event, otherwise false.
310310

311+
<a id="triggeringeventid"></a>
312+
313+
##### `triggeringEventId()`
314+
315+
Gets the external ID of the event that triggered this workflow run. Useful for correlating tasks back to the originating [event](/v1/external-events/run-on-event) or [webhook](/v1/webhooks).
316+
317+
Returns
318+
319+
`string` \| `undefined`
320+
321+
The triggering event external ID, or undefined if not triggered by an event.
322+
323+
<a id="triggeringeventkey"></a>
324+
325+
##### `triggeringEventKey()`
326+
327+
Gets the key of the event that triggered this workflow run. This corresponds to the event key used when the event was pushed or generated by a webhook.
328+
329+
Returns
330+
331+
`string` \| `undefined`
332+
333+
The triggering event key, or undefined if not triggered by an event.
334+
311335
<a id="triggers"></a>
312336

313337
##### `triggers()`

frontend/docs/pages/v1/webhooks.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ The **Static Payload** is an optional JSON object that gets merged with the inco
6262

6363
For example, if you set a static payload of `{"source": "stripe", "environment": "production"}` and receive a webhook with `{"type": "payment_intent.created", "source": "api"}`, the final payload passed to your workflow would be `{"type": "payment_intent.created", "source": "stripe", "environment": "production"}`.
6464

65+
#### Return Event as Response Payload
66+
67+
The **Return Event as Response Payload** toggle controls whether Hatchet returns the triggered event in the webhook HTTP response. This is enabled by default but can be disabled to avoid exposing sensitive information in responses.
68+
69+
When enabled, the response includes the created event with its ID, which is useful for correlating webhook triggers with specific workflow runs. When disabled, the response omits the event payload.
70+
6571
#### Authentication
6672

6773
Finally, you'll need to specify how Hatchet should authenticate incoming webhook requests. For non-generic sources like Stripe and Github, Hatchet has presets for most of the fields, so in most cases you'd only need to provide a secret.

0 commit comments

Comments
 (0)