Webhook
Listens to events that occur on this event and proceeds to the next step in the flow.
Last updated
Was this helpful?
Listens to events that occur on this event and proceeds to the next step in the flow.
Last updated
Was this helpful?
A webhook listens for incoming events on a specified endpoint and triggers the next step in the workflow upon receiving relevant data.
Webhooks listen for events from third-party apps.
They are commonly used for tasks like payment collection, where the chatbot waits for a payment processor to notify it once the payment is received.
Set this webhook endpoint in the application that will send the event.
When calling this endpoint, you must include the conversation_key in the response payload. If it’s missing, the system will not consider the response successful.
You can extract the conversation_key from the Conversation URL variable.
Before using the webhook block, add a JavaScript Action Block with the following code.
const conversation_url = "Conversation URL";
// Function to extract the conversation key from the URL
function getLastPartOfUrl(url) {
// Split the URL by slashes
const parts = url.split('/');
// Return the last part
return parts[parts.length - 1];
}
// Retrieve the conversation key from the URL
const conversation_key = getLastPartOfUrl(conversation_url);
// Sets the conversation key into a new variable
wn.setConversationVariable("conversation_key", conversation_key);
// This variable will be used to push the conversation_key to the third-party app.
The chat flow will wait for the webhook call for a set duration.
If the webhook is not triggered within this timeframe, the chat flow will continue through the FAILURE path.
When a webhook response is received, you can assign specific fields to variables for storage.
Set the duration between 1 and 300 seconds.
You can map a maximum of 50 variables.