Webhooks (Continuation URL)

Every state has a special configuration section called "Execution Options". You can spot it here:

Execution Options

If the toggle "Continue Execution" is switched off, then the state won't keep executing after it has been reached. The state's logic will run, and then that's it, the state will halt.

This is useful for cases where you need to make an API call to some 3rd party, and this 3rd party needs to send back a webhook notifying that it has "done its part, and now it's time to continue on your side". So you might want to continue the flow execution only after the 3rd party notified you via webhook.

With this in mind, the 3rd party needs to know where the webhook should be made to (which endpoint to call once that 3rd party is done), and for this reason we've created the execution.CONTINUATION_URL injectable value.

This value will contain a URL that the 3rd party needs to call, and this will cause the flow execution to continue from the exact state it stopped. The 3rd party may supply anything in the request body, and this can then be used by your flow using the outputs injectable value.

Full example:

  1. Define an HTTP request state that makes an API call to some endpoint. (imagine that 3rd party that processes stuff offline).

  2. Let's say that this 3rd party supports a callback URL (which is quite a common pattern) as part of the request body, under the "callbackUrl" field in the JSON object. So when configuring the Request Body field in the HTTP state configuration, you might specify the following:

"someField": "someValue",
"user": $((entryPayload.user)),
"callbackUrl": "$((execution.CONTINUATION_URL))"

During execution time, the "callbackUrl" field will receive an endpoint that allows the 3rd party to make a call to it to continue the execution of the state.

3. In state's execution options tab, disable the continue execution toggle. Done! When the state runs, a request will be made to the desired endpoint, and so the 3rd party will get a webhook URL to notify as soon as it's done.

The continuation URL uses a Continuation Token, which can be found in your settings under /settings/api. If a certain 3rd party that you are using is compromised, you might want to consider re-generating this token, however note that this will invalidate any generated CONTINUATION_URLs that haven't been used yet.

IMPORTANT: The continuation URL generated during execution time will ONLY be valid to continue the execution for the state it was defined at, and for the specific execution it was generated in. MEANING, if the said 3rd party expects one single webhook URL for all webhook calls, and it differentiates between webhooks using request body rather than URL data (like query or params), this functionality won't work for you, and we currently do not offer a different solution. But if it's something you are interested in, raise it as a feature request.