PageSourceSearch

https://embedded-workflow-builder.netlify.app/assets/js/a9d38e0e.d89ce433.js

js embedded-workflow-builder.netlify.app collected 2026-10-03 10:45:47 UTC 26,666 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkembedded_workflow_builder_docs=self.webpackChunkembedded_workflow_builder_docs||[]).push([["7903"],{18132(e,o,n){n.r(o),n.d(o,{metadata:()=>t,default:()=>d,frontMatter:()=>i,contentTitle:()=>a,toc:()=>h,assets:()=>l});var t=JSON.parse('{"id":"triggering","title":"Triggering Workflows","description":"Learn about the different types of triggers available in the Workflow Builder and how to configure them for your Workflows.","source":"@site/docs/triggering.md","sourceDirName":".","slug":"/triggering","permalink":"/triggering","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{"title":"Triggering Workflows","description":"Learn about the different types of triggers available in the Workflow Builder and how to configure them for your Workflows."},"sidebar":"docs","previous":{"title":"Looping","permalink":"/looping"},"next":{"title":"Testing Workflows","permalink":"/testing"}}'),r=n(74848),s=n(28453);let i={title:"Triggering Workflows",description:"Learn about the different types of triggers available in the Workflow Builder and how to configure them for your Workflows."},a,l={},h=[{value:"Selecting a trigger type",id:"selecting-a-trigger-type",level:2},{value:"Schedule triggers",id:"schedule-triggers",level:2},{value:"App event triggers",id:"app-event-triggers",level:2},{value:"App event triggers with webhooks",id:"app-event-triggers-with-webhooks",level:3},{value:"Testing webhook-based app event triggers",id:"testing-webhook-based-app-event-triggers",level:3},{value:"App event triggers with polling",id:"app-event-triggers-with-polling",level:3}
1,{value:"Universal webhook triggers",id:"universal-webhook-triggers",level:2},{value:"What is a webhook?",id:"what-is-a-webhook",level:3},{value:"Your Workflow's webhook URL",id:"your-workflows-webhook-url",level:3},{value:"Webhook request payloads",id:"webhook-request-payloads",level:3},{value:"Posting data to a webhook URL",id:"posting-data-to-a-webhook-url",level:4},{value:"Posting binary webhook data",id:"posting-binary-webhook-data",level:4},{value:"Posting multipart webhook data",id:"posting-multipart-webhook-data",level:4},{value:"Webhook security",id:"webhook-security",level:3},{value:"Synchronous and asynchronous invocations",id:"synchronous-and-asynchronous-invocations",level:3},{value:"Default asynchronous webhook responses",id:"default-asynchronous-webhook-responses",level:4},{value:"Custom HTTP responses for asynchronous webhook requests",id:"custom-http-responses-for-asynchronous-webhook-requests",level:4},{value:"HTTP responses for synchronous invocations",id:"http-responses-for-synchronous-invocations",level:4}];function c(e){let o={a:"a",blockquote:"blockquote",code:"code",em:"em",h2:"h2",h3:"h3",h4:"h4",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.p,{children:"Triggers allow you to define when a Workflow should run. In the Workflow Builder, you can set up various types of triggers to initiate your workflows based on different events or conditions."}),"\n",(0,r.jsxs)(o.p,{children:["If you want your Workflow to run on a consistent schedule, use a ",(0,r.jsx)(o.a,{href:"#schedule-triggers",children:"schedule trigger"}),".\nIf you want your Workflow to run in response to an event in another application, use an ",(0,r.jsx)(o.a,{href:"#app-event-triggers",children:"app event trigger"}),".\nIf you want your Workflow to run in response to a webhook request, use a ",(0,r.jsx)(o.a,{href:"#universal-webhook-triggers",children:"universal webhook trigger"}),"."]}),"\n",(0,r.jsx)(o.h2,{id:"selecting-a-trigger-type",children:"Selecting a trigger type"}),"\n",(0,r.jsxs)(o.p,{children:["When you ",(0,r.jsx)(o.a,{href:"/building",children:"create a new Workflow"})," in the Workflow Builder, you will be prompted to select a trigger type.\nTo change the trigger type of an existing Workflow, click the menu to the left of the trigger at the top of the Workflow editor and select ",(0,r.jsx)(o.strong,{children:"Change step action"}),"."]}),"\n",(0,r.jsx)(o.h2,{id:"schedule-triggers",children:"Schedule triggers"}),"\n",(0,r.jsx)(o.p,{children:'Schedule triggers allow you to run your Workflow on a regular cadence (like "every 5 minutes" or "Mondays at 8:00 AM CST").\nThis is useful if your Workflow should be triggered at a specific time.'}),"\n",(0,r.jsxs)(o.p,{children:["To configure a schedule, click the trigger at the top of the Workflow editor and open the ",(0,r.jsx)(o.strong,{children:"Configure"}),' drawer on the right side of the screen.\nYou can then select the frequency of the trigger, such as "every 5 minutes", "every hour", or "every day at a specific time".']}),"\n",(0,r.jsx)(o.p,{children:(0,r.jsx)(o.img,{alt:"Schedule trigger configuration",src:n(516).A+"",width:"731",height:"786"})}),"\n",(0,r.jsxs)(o.blockquote,{children:["\n",(0,r.jsx)(o.p,{children:(0,r.jsx)(o.strong,{children:"Tip: Use Cron expressions for advanced scheduling"})}),"\n",(0,r.jsxs)(o.p,{children:["You can also set up more complex schedules using ",(0,r.jsx)(o.a,{href:"https://en.wikipedia.org/wiki/Cron#CRON_expression",children:"cron expressions"})," to specify exactly when the Workflow should run by selecting ",(0,r.jsx)(o.strong,{children:"Custom"})," as your ",(0,r.jsx)(o.strong,{children:"Schedule type"}),".\nFor example, a custom schedule of ",(0,r.jsx)(o.code,{children:"*/5 8-16 * * 1-5"})," would cause your Workflow to run every five minutes during business hours (8:00-16:55), Monday through Friday.\nFor help computing a cron schedule, see this ",(0,r.jsx)(o.a,{href:"https://crontab.guru/",children:"Cron Calculator"}),"."]}),"\n"]}),"\n",(0,r.jsx)(o.h2,{id:"app-event-triggers",children:"App event triggers"}),"\n",(0,r.jsxs)(o.p,{children:["App event triggers run when data changes in a third-party application.\nFor example, you may want to be notified when an ",(0,r.jsx)(o.a,{href:"/connectors/asana#workspaceprojectstrigger",children:"Asana Project"})," is created, updated, or deleted, or when a ",(0,r.jsx)(o.a,{href:"/connectors/pagerduty#incidentstrigger",children:"PagerDuty Incident"})," occurs."]}),"\n",(0,r.jsxs)(o.p,{children:["If the connector you're working with does not have a built-in app event trigger, you can use the ",(0,r.jsx)(o.a,{href:"#universal-webhook-triggers",children:"universal webhook trigger"})," to receive event notifications from a third-party application, or the ",(0,r.jsx)(o.a,{href:"#schedule-triggers",children:"schedule trigger"})," to periodically check for updates from the third party."]}),"\n",(0,r.jsx)(o.h3,{id:"app-event-triggers-with-webhooks",children:"App event triggers with webhooks"}),"\n",(0,r.jsx)(o.p,{children:"Some connectors support app event triggers that are powered by webhooks.\nThese triggers allow your Workflow to run in response to events in the third-party application without needing to poll for updates."}),"\n",(0,r.jsxs)(o.p,{children:["Webhooks are configured automatically when you ",(0,r.jsx)(o.a,{href:"/enabling",children:"enable"})," your workflow in the Workflow Builder.\nWhen you enable your Workflow, the runner will automatically create a webhook in the third-party application to listen for events.\nWhen an event occurs, the third-party application will send a request to your Workflow's webhook URL, triggering the Workflow to run."]}),"\n",(0,r.jsx)(o.h3,{id:"testing-webhook-based-app-event-triggers",children:"Testing webhook-based app event triggers"}),"\n",(0,r.jsxs)(o.p,{children:["After configuring a trigger that uses webhooks, you can test and capture webhook requests using the ",(0,r.jsx)(o.strong,{children:"Test"})," tab in the trigger's configuration drawer.\nYou can see your Workflow's unique test webhook URLs, by clicking ",(0,r.jsx)(o.strong,{children:"Webhook URLs"}),"."]}),"\n",(0,r.jsx)(o.p,{children:(0,r.jsx)(o.img,{alt:"Testing webhook-based app event triggers",src:n(18989).A+"",width:"1500",height:"818"})}),"\n",(0,r.jsxs)(o.p,{children:["Click ",(0,r.jsx)(o.strong,{children:"Enter Listening Mode"})," to have your Workflow listen for incoming webhook requests at the test URL."]}),"\n",(0,r.jsxs)(o.p,{children:["Some triggers will automatically configure webhooks in the third-party app when ",(0,r.jsx)(o.strong,{children:"listening mode"})," is enabled.\nOther third-party apps may require you to manually configure the webhook in their settings."]}),"\n",(0,r.jsx)(o.p,{children:"Once the webhook is configured, you can generate a test event in the third-party application to send a webhook request to your Workflow's test URL.\nIn the example here, we marked a task as complete in Asana, which caused Asana to send a webhook request to our Workflow's test URL."}),"\n",(0,r.jsx)(o.p,{children:(0,r.jsx)(o.img,{alt:"Captured webhook request",src:n(69031).A+"",width:"1500",height:"1133"})}),"\n",(0,r.jsxs)(o.p,{children:["We can save the captured webhook request for use in testing our Workflow by giving it a name and clicking ",(0,r.jsx)(o.strong,{children:"Save"}),".\nWe can then use that saved webhook request and use it later in our testing.\nSaved payloads are available in the ",(0,r.jsx)(o.strong,{children:"Test"})," tab of the trigger's configuration drawer under ",(0,r.jsx)(o.strong,{children:"Saved Payloads"}),", and you can run your Workflow using that payload by clicking ",(0,r.jsx)(o.strong,{children:"Run"})," button that appears when your mouse overs over the payload."]}),"\n",(0,r.jsxs)(o.p,{children:["If you would like to test your Workflow with a custom webhook payload, you can click ",(0,r.jsx)(o.strong,{children:"Configure Payload"})," to edit the payload data."]}),"\n",(0,r.jsx)(o.h3,{id:"app-event-triggers-with-polling",children:"App event triggers with polling"}),"\n",(0,r.jsx)(o.p,{children:"Some applications do not support webhooks, or webhook configuration is tedious.\nPolling triggers are useful when you want to be notified when data changes in those applications."}),"\n",(0,r.jsx)(o.p,{children:'A polling trigger will poll an external API on a schedule that you set (for example, "every 5 minutes"), and if new data is available since the last time it polled, a full execution will run so your Workflow can process the data.'}),"\n",(0,r.jsxs)(o.p,{children:["If you'd like to listen for new records in a PostgreSQL database, for example, you can use the ",(0,r.jsx)(o.a,{href:"/connectors/postgres#triggers",children:"PostgreSQL Polling Trigger"})," to poll the database for new records every few minutes."]}),"\n",(0,r.jsx)(o.h2,{id:"universal-webhook-triggers",children:"Universal webhook triggers"}),"\n",(0,r.jsx)(o.p,{children:"The universal webhook trigger allows you to run your Workflow in response to a webhook request from any third-party application that supports webhooks.\nThis is useful if you want to re
1ceive real-time notifications from an application whose connector does not have a built-in app event trigger in the Workflow Builder."}),"\n",(0,r.jsx)(o.h3,{id:"what-is-a-webhook",children:"What is a webhook?"}),"\n",(0,r.jsxs)(o.p,{children:["A ",(0,r.jsx)(o.strong,{children:"webhook"})," is an automated message sent from one application to another when certain events occur.\nWebhooks let applications notify one another in real time when something has changed in one system and can be used to trigger a Workflow so the change is reflected in the other system."]}),"\n",(0,r.jsx)(o.p,{children:"A webhook consists of two main parts:"}),"\n",(0,r.jsxs)(o.ul,{children:["\n",(0,r.jsxs)(o.li,{children:["The ",(0,r.jsx)(o.strong,{children:"event"})," that causes the webhook to fire.\nThe event is usually a change to a record in an application.\nFor example, you may have a ",(0,r.jsx)(o.code,{children:"contact.changed"})," or ",(0,r.jsx)(o.code,{children:"report.created"})," event."]}),"\n",(0,r.jsxs)(o.li,{children:["The ",(0,r.jsx)(o.strong,{children:"endpoint"})," where information about the event is sent.\nThe endpoint is a URL that you provide to the application that will receive the webhook."]}),"\n"]}),"\n",(0,r.jsx)(o.h3,{id:"your-workflows-webhook-url",children:"Your Workflow's webhook URL"}),"\n",(0,r.jsx)(o.p,{children:"Your Workflow has two URLs:"}),"\n",(0,r.jsxs)(o.ol,{children:["\n",(0,r.jsxs)(o.li,{children:["A ",(0,r.jsx)(o.strong,{children:"Test URL"})," you can use to test your webhook configuration within the Workflow Builder."]}),"\n",(0,r.jsxs)(o.li,{children:["A ",(0,r.jsx)(o.strong,{children:"Live URL"})," that is used when your Workflow is ",(0,r.jsx)(o.a,{href:"/enabling",children:"enabled"})," and running in production."]}),"\n"]}),"\n",(0,r.jsxs)(o.p,{children:["Both URLs are available in the ",(0,r.jsx)(o.strong,{children:"Test"})," tab of your trigger's configuration drawer.\nYour Workflows URLs will each be unique and will look similar to ",(0,r.jsx)(o.code,{children:"https://hooks.integrations.acme.com/trigger/SW5zEXAMPLE1234567890"})]}),"\n",(0,r.jsx)(o.h3,{id:"webhook-request-payloads",children:"Webhook request payloads"}),"\n",(0,r.jsxs)(o.p,{children:["When a webhook fires, the application where the event occurred will generally send a POST request to the endpoint you provided.\nMost applications will send a JSON payload in the request body that contains information about the event that occurred (though some, notably ",(0,r.jsx)(o.a,{href:"/connectors/salesforce",children:"Salesforce"}),", send XML payloads)."]}),"\n",(0,r.jsx)(o.p,{children:"Some payloads contain the entire record that changed, while others contain only the record's ID and you are expected to fetch the record yourself."}),"\n",(0,r.jsxs)(o.p,{children:["To test a webhook request, you can use the test URL in the Workflow Builder to send a sample payload using an HTTP client like ",(0,r.jsx)(o.a,{href:"https://www.postman.com/",children:"Postman"})," or ",(0,r.jsx)(o.a,{href:"https://curl.se/",children:"cURL"}),"."]}),"\n",(0,r.jsx)(o.h4,{id:"posting-data-to-a-webhook-url",children:"Posting data to a webhook URL"}),"\n",(0,r.jsx)(o.p,{children:"Data is typically sent as a JSON object in the request body of the webhook request, though the universal webhook trigger also parses data from the following sources:"}),"\n",(0,r.jsxs)(o.ul,{children:["\n",(0,r.jsxs)(o.li,{children:["The ",(0,r.jsx)(o.strong,{children:"request body"})," - the JSON (or other) data sent to the webhook as an ",(0,r.jsx)(o.a,{href:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages#body",children:"HTTP request body"}),"."]}),"\n",(0,r.jsxs)(o.li,{children:["The ",(0,r.jsx)(o.strong,{children:"request headers"})," - the ",(0,r.jsx)(o.a,{href:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages#headers",children:"HTTP headers"}),"."]}),"\n",(0,r.jsxs)(o.li,{children:["The ",(0,r.jsx)(o.strong,{children:"URL path"})," - The ",(0,r.jsx)(o.a,{href:"https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL#path_to_resource",children:"path to resource"})," that follows the Workflow webhook URL."]}),"\n",(0,r.jsxs)(o.li,{children:["The ",(0,r.jsx)(o.strong,{children:"URL parameters"})," - The ",(0,r.jsx)(o.a,{href:"https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL#parameters",children:"parameters"})," that follow the ",(0,r.jsx)(o.code,{children:"?"})," in a URL."]}),"\n"]}),"\n",(0,r.jsxs)(o.p,{children:["Take, for example, this ",(0,r.jsx)(o.code,{children:"curl"})," invocation:"]}),"\n",(0,r.jsx)(o.pre,{children:(0,r.jsx)(o.code,{className:"language-bash",children:'curl \\\n  \'https://hooks.integrations.acme.com/trigger/SW5zEXAMPLE1234567890==/my/custom/path?param-one=ParamValueOne&param-two=ParamValueTwo\' \\\n  --header "header-one: First header value" \\\n  --header "header-two: Second header value" \\\n  --header "Content-Type: application/json" \\\n  --data \'{"Payload Key 1":"Payload Value 1","Do Thing?":true,"quantity":123}\'\n'})}),"\n",(0,r.jsxs)(o.ul,{children:["\n",(0,r.jsxs)(o.li,{children:["The request body - ",(0,r.jsx)(o.code,{children:'{"Payload Key 1":"Payload Value 1","Do Thing?":true,"quantity":123}'})," - is parsed (if JSON) and is accessible to the Workflow by referencing the trigger's ",(0,r.jsx)(o.code,{children:"results.body.data.KEY-NAME"}),". Non-JSON payloads (like XML, images, etc.) are accessible through ",(0,r.jsx)(o.code,{children:"results.rawBody"})," and can be parsed in subsequent steps that handle that type of data."]}),"\n",(0,r.jsxs)(o.li,{children:["The request headers are accessible through the trigger's ",(0,r.jsx)(o.code,{children:"results.headers.HEADER-NAME"}),"."]}),"\n",(0,r.jsxs)(o.li,{children:["The URL path - ",(0,r.jsx)(o.code,{children:"my/custom/path"})," - is accessible through the trigger's ",(0,r.jsx)(o.code,{children:"results.pathFragment"}),". You can pass that data into the built-in ",(0,r.jsx)(o.a,{href:"/connectors/text-manipulation#split",children:"split string"})," action and split on the ",(0,r.jsx)(o.code,{children:"/"})," character to split the URL path into an array ",(0,r.jsx)(o.code,{children:"['my','custom','path']"}),"."]}),"\n",(0,r.jsxs)(o.li,{children:["The URL parameters - ",(0,r.jsx)(o.code,{children:"?param-one=ParamValueOne&param-two=ParamValueTwo"})," are parsed and accessible through the trigger's ",(0,r.jsx)(o.code,{children:"results.queryParameters.PARAMETER-NAME"}),"."]}),"\n"]}),"\n",(0,r.jsx)(o.p,{children:(0,r.jsx)(o.img,{alt:"Webhook request payload example",src:n(54163).A+"",width:"500",height:"686"})}),"\n",(0,r.jsx)(o.h4,{id:"posting-binary-webhook-data",children:"Posting binary webhook data"}),"\n",(0,r.jsxs)(o.p,{children:["If you have binary data (like an image or PDF) that you would like to post as part of your webhook invocation, you can pass that binary data as part of your request.\nFor example, if you have an image, ",(0,r.jsx)(o.code,{children:"my-image.png"}),", you could invoke a test of a Workflow with:"]}),"\n",(0,r.jsx)(o.pre,{children:(0,r.jsx)(o.code,{className:"language-bash",children:"curl 'https://hooks.integrations.acme.com/trigger/SW5zEXAMPLE1234567890' \\\n  --request POST \\\n  --header 'Content-Type: image/png' \\\n  --data-binary '@/
1path/to/my-image.png'\n"})}),"\n",(0,r.jsxs)(o.p,{children:["The binary file can be accessed by subsequent steps by referencing ",(0,r.jsx)(o.code,{children:"trigger.results.body.data"}),"."]}),"\n",(0,r.jsx)(o.h4,{id:"posting-multipart-webhook-data",children:"Posting multipart webhook data"}),"\n",(0,r.jsxs)(o.p,{children:["It's useful to be able to post a combination of binary and text data to a Workflow.\nFor example, you might want to post information about a person, as well as an avatar image of the person, to be processed by your Workflow.\nTo do that, use a content type of ",(0,r.jsx)(o.code,{children:"multipart/form-data"})," with your webhook invocation:"]}),"\n",(0,r.jsx)(o.pre,{children:(0,r.jsx)(o.code,{className:"language-bash",children:'curl \'https://hooks.integrations.acme.com/trigger/SW5zEXAMPLE1234567890\' \\\n  --request POST \\\n  --header "Content-Type: multipart/form-data" \\\n  --form person=\'{"firstname":"John","lastname":"Doe"};type=application/json\' \\\n  --form [email protected]\n'})}),"\n",(0,r.jsxs)(o.p,{children:["The first name in this example is accessible by referencing the trigger's ",(0,r.jsx)(o.code,{children:"results.body.data.person.data.firstname"}),", and the avatar image is accessible by referencing ",(0,r.jsx)(o.code,{children:"results.body.data.photo"}),"."]}),"\n",(0,r.jsx)(o.p,{children:(0,r.jsx)(o.img,{alt:"Multipart webhook request payload example",src:n(72327).A+"",width:"500",height:"577"})}),"\n",(0,r.jsx)(o.h3,{id:"webhook-security",children:"Webhook security"}),"\n",(0,r.jsxs)(o.p,{children:["Webhooks are often secured using Hashed Message Authentication Codes (HMAC) to ensure that the request is coming from an expected source.\nYou can use the ",(0,r.jsx)(o.a,{href:"/connectors/hash#hmacwebhooktrigger",children:"Hash"})," connector's HMAC trigger to implement HMAC security for your webhook requests.\nThis trigger will reject any request that is not properly signed with the expected HMAC signature."]}),"\n",(0,r.jsx)(o.h3,{id:"synchronous-and-asynchronous-invocations",children:"Synchronous and asynchronous invocations"}),"\n",(0,r.jsxs)(o.p,{children:["Workflows are configured by default to run ",(0,r.jsx)(o.strong,{children:"asynchronously"}),".\nThat means that an external application makes a request to a Workflow webhook URL, but does not wait for the Workflow to finish running."]}),"\n",(0,r.jsxs)(o.p,{children:["Sometimes, though, it's useful for an application to get information back from the Workflow that was invoked.\nIn that case, you can choose to run your Workflow ",(0,r.jsx)(o.strong,{children:"synchronously"}),"."]}),"\n",(0,r.jsxs)(o.p,{children:["When a Workflow is invoked synchronously, the external application makes a request to the Workflow's webhook URL and waits for the Workflow to finish running before receiving a response.\nThe caller receives an HTTP response with the results of the ",(0,r.jsx)(o.em,{children:"last step"})," of the Workflow."]}),"\n",(0,r.jsx)(o.h4,{id:"default-asynchronous-webhook-responses",children:"Default asynchronous webhook responses"}),"\n",(0,r.jsxs)(o.p,{children:["By default, a Workflow runs ",(0,r.jsx)(o.strong,{children:"asynchronously"}),' and its webhook trigger provides an HTTP code 200 ("OK") response to callers.\nThe body of the response contains the ID of the execution that was triggered.\nYour request and response might look something like this:']}),"\n",(0,r.jsx)(o.pre,{children:(0,r.jsx)(o.code,{className:"language-text",children:'curl \\\n  --data \'{}\' \\\n  --header "Content-Type: application/json" \\\n  \'https://hooks.integrations.acme.com/trigger/SW5zEXAMPLE1234567890\'\n\n{"executionId":"SW5zdGFuY2VFeGVjdXRpb25SZXN1bHQ6OTdiNWQxYmEtZGUyZi00ZDY4LWIyMTgtMDFlZGMwMTQxNTM5"}\n'})}),"\n",(0,r.jsx)(o.h4,{id:"custom-http-responses-for-asynchronous-webhook-requests",children:"Custom HTTP responses for asynchronous webhook requests"}),"\n",(0,r.jsx)(o.p,{children:"If you would like to provide a different HTTP status code in response to a webhook request, you have two options:"}),"\n",(0,r.jsxs)(o.ol,{children:["\n",(0,r.jsxs)(o.li,{children:["\n",(0,r.jsxs)(o.p,{children:["To provide a consistent HTTP status code for all asynchronous webhook requests, configure the default response code in the Workflow Builder by clicking on the trigger at the top of the Workflow editor and opening the ",(0,r.jsx)(o.strong,{children:"Configure"})," drawer on the right side of the screen."]}),"\n",(0,r.jsx)(o.p,{children:(0,r.jsx)(o.img,{alt:"Default response code configuration",src:n(87208).A+"",width:"500",height:"458"})}),"\n",(0,r.jsx)(o.p,{children:"You can also provide a static text response body and response headers within the universal webhook trigger configuration drawer."}),"\n"]}),"\n",(0,r.jsxs)(o.li,{children:["\n",(0,r.jsxs)(o.p,{children:["To provide a dynamic HTTP response dependent on the request, write custom JavaScript code using a ",(0,r.jsx)(o.a,{href:"/connectors/code#runcodetrigger",children:"Code Block Trigger"}),"."]}),"\n",(0,r.jsx)(o.pre,{children:(0,r.jsx)(o.code,{className:"language-javascript",metastring:'title="Custom JavaScript code for a trigger"',children:'module.exports = async ({ logger, configVars }, payload) => {\n  let response = {};\n\n  if (payload.body.data.quantity > 0) {\n    response = {\n      statusCode: 201,\n      contentType: "application/json",\n      body: JSON.stringify({ status: "Created" }),\n    };\n  } else {\n    response = {\n      statusCode: 400,\n      contentType: "application/json",\n      body: JSON.stringify({ error: "Quantity must be positive" }),\n    };\n  }\n\n  return { payload, response };\n};\n'})}),"\n",(0,r.jsxs)(o.p,{children:['In this example, the response will be a 201 ("Created") status code if the ',(0,r.jsx)(o.code,{children:"quantity"}),' in the request body is greater than 0, or a 400 ("Bad Request") status code if it is not.\nThe response body will contain a JSON object with a ',(0,r.jsx)(o.code,{children:"status"})," or ",(0,r.jsx)(o.code,{children:"error"})," message."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(o.h4,{id:"http-responses-for-synchronous-invocations",children:"HTTP responses for synchronous invocations"}),"\n",(0,r.jsxs)(o.p,{children:["When a Workflow is invoked ",(0,r.jsx)(o.strong,{children:"synchronously"}),", the external application waits for the Workflow to finish running before receiving a response.\nThe response will c
1ontain the results of the ",(0,r.jsx)(o.em,{children:"last step"})," of the Workflow, usually in the form of a JSON object."]}),"\n",(0,r.jsxs)(o.p,{children:["If you would like to return a custom HTTP status code, response body, or response headers, you can do so by using a ",(0,r.jsx)(o.a,{href:"/connectors/code#runcode",children:"Code Block"})," step at the end of your Workflow."]}),"\n",(0,r.jsx)(o.pre,{children:(0,r.jsx)(o.code,{className:"language-javascript",children:'module.exports = async (context, stepResults) => {\n  return {\n    statusCode: 202,\n    contentType: "application/json",\n    headers: { "X-Custom-Header": "foo" },\n    body: JSON.stringify({ message: "Workflow completed successfully" }),\n  };\n};\n'})}),"\n",(0,r.jsxs)(o.p,{children:["Read more about ",(0,r.jsx)(o.a,{href:"/custom-code",children:"using code blocks"}),"."]})]})}function d(e={}){let{wrapper:o}={...(0,s.R)(),...e.components};return o?(0,r.jsx)(o,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},87208(e,o,n){n.d(o,{A:()=>t});let t=n.p+"assets/images/asynchronous-default-status-code-4462026019a2231d4591a1ad172f589c.png"},54163(e,o,n){n.d(o,{A:()=>t});let t=n.p+"assets/images/http-request-90b349c9a9dd99c58733667a6d14bd7f.png"},72327(e,o,n){n.d(o,{A:()=>t});let t=n.p+"assets/images/multipart-4909b0dcf2d1a14a6863b1ca1559ee8e.png"},516(e,o,n){n.d(o,{A:()=>t});let t=n.p+"assets/images/schedule-3269768c4a25ab0d15032600c24b5d85.png"},18989(e,o,n){n.d(o,{A:()=>t});let t=n.p+"assets/images/test-webhook-drawer-8be250b52dc92141204f5c6210f509b0.png"},69031(e,o,n){n.d(o,{A:()=>t});let t=n.p+"assets/images/test-webhook-listening-mode-0ee24bb6cf52c808126bf31649858989.png"},28453(e,o,n){n.d(o,{R:()=>i,x:()=>a});var t=n(96540);let r={},s=t.createContext(r);function i(e){let o=t.useContext(s);return t.useMemo(function(){return"function"==typeof e?e(o):{...o,...e}},[o,e])}function a(e){let o;return o=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),t.createElement(s.Provider,{value:o},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.