Repository navigation
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
The change still has unresolved issues because the Webhook step dialog’s saveResponseAs validation and messaging don’t match backend constraints (including reserved names), and the accompanying docs omit an enforced naming rule, leaving users prone to confusing submission failures.
2 open issues
What changed in this PR
Adds an optional saveResponseAs setting to WEBHOOK workflow steps so successful webhook JSON responses can be stored in the workflow execution context and referenced by later steps via the existing {{event.*}} templating.
Changes:
- Extend the webhook step config schema with validated
saveResponseAs(including reserved-name protection). - Update webhook execution to persist bounded (≤64 KB), 2xx responses into execution context and surface
savedAsin step output when configured. - Add UI support, documentation updates, and tests covering the new behavior and validation.
| File | Description |
|---|---|
| packages/shared/src/schemas/index.ts | Adds an optional, validated saveResponseAs field to the webhook step schema with constraints and reserved-name checks. |
| apps/wiki/content/docs/guides/webhooks.mdx | Documents how to save a webhook response into context and reference it in later workflow steps. |
| apps/wiki/content/docs/concepts/workflows.mdx | Updates the workflows documentation to include saveResponseAs as an optional configuration for WEBHOOK steps. |
| apps/web/src/components/workflow-steps/WebhookStepDialog.tsx | Adds a dialog input for configuring saveResponseAs on webhook steps and includes it in step updates. |
| apps/api/src/services/WorkflowExecutionService.ts | Implements saving successful, size-bounded webhook responses into the workflow execution context and reports savedAs in the step output. |
| apps/api/src/services/__tests__/WorkflowExecutionService.webhook.test.ts | Adds test coverage for saving webhook responses into context, downstream templating usage, and invalid/reserved name handling. |
Review effort: Balanced
Comment on lines
+48
to
+52
| const responseKey = saveResponseAs.trim(); | ||
| if (responseKey && !/^[A-Za-z_][A-Za-z0-9_]{0,63}$/.test(responseKey)) { | ||
| toast.error('Response name may only contain letters, digits and underscores'); | ||
| return; | ||
| } |
… schema Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What
Adds an optional
saveResponseAssetting to theWEBHOOKworkflow step. When set, the parsed JSON body of a successful (2xx) response is stored in the execution context under that key, so later steps can use it like trigger event data, e.g.{{event.coupon.code}}in aSEND_EMAILtemplate, aCONDITION, or anotherWEBHOOK.Why
Workflows often need a value that only an external system can produce at run time, for example a unique one-time coupon code created by the shop right before an abandoned-cart email. Today the webhook response is only stored in the step output and is not available to later steps.
How
WorkflowStepConfigSchemas.webhook: new optionalsaveResponseAs(letters, digits, underscores, max 64 chars, not starting with a digit;id,email,data,event,unsubscribeUrl,subscribeUrl,manageUrlare rejected).executeWebhook: on a 2xx response of at most 64 KB, merges{[saveResponseAs]: parsedResponse}intoworkflowExecution.context(one update, no new query patterns). Non-2xx or oversized responses are not saved. The step output getssavedAs(key ornull) when the option is used.guides/webhooks.mdx(new section) and the step table inconcepts/workflows.mdx.Existing webhook steps are unaffected (no
saveResponseAs→ no context change, step output unchanged).Tests
WorkflowExecutionService.webhook.test.ts: saves the response into the context, a later webhook renders{{event.coupon.code}}, nothing saved on 5xx, no change without the option, reserved/invalid names rejected.