VoiceBooker

Webhooks

Webhooks allow the assistant to interact with external systems and integrate them into your workflow. With webhooks, the assistant can either retrieve up-to-date information (e.g. customer data, available products, or free appointment slots) or send/submit collected information (e.g. after a user completed a transaction/booking).

How To Configure Webhooks

Webhooks can be configured directly within a function/action by toggling the webhook switch and providing the Webhook URL as shown below:

The voice bot will then send the extracted parameters as the request body in a POST request.

Post Processing

If the webhook is used to retrieve data, it is sometimes necessary to transform the data, e.g. filter items or format values.

If post processing is needed, the Post hook JS function call field can be used to specify the name of a function that should be called right after the webhook retrieved the data.

The function parameter will be the webhook response body: a nested JSON object if the body is valid JSON; otherwise a string (if the body could not be parsed as JSON).

Programmatic Execution Of Webhooks

Webhooks can also be executed programmatically from any JavaScript code snippet at any time as follows:

function myFunction(params) {
    response = webhook("https://mydomain.com/apiEndpoint", {"sample": "data"});
    return response;
}

Parameters

ParameterDescription
urlThe URL including all GET parameters that should be called
bodyThe body/a JavaScript object which will be sent as the body in POST/PUT requests
options (Optional)method: "get"|"put"|"post"|"delete"|"head"
options (Optional)ttlCache: 0 (if the request should be cached)
options (Optional)raw: true|false - if response headers should also be returned

On this page