Webhooks & API Requests

SendRequest can be used to send a new webhook request to any URL or fetch data from an API call. As soon as the flow of conversation reaches SendRequest, a new request is sent with the text column as the body of the request. The method of request can be GET or POST. The format for this type is SendRequest-. Here the method can be GET or POST and the URL is the webhook URL which is listening for requests. The server must send a 200 response to the request. Otherwise, the request will be retried again. The request is retried for a maximum of 3 times in 1-minute intervals.

Example: SendRequest-GET-https://your-webhook-url.com/path

The ID and Goto are not required in the SendRequest row. The text column can be used to specify the header, body of the request as well to save the response in a variable. The format of text column is a JSON object which has “body” as a key in whose value (can be JSON) is sent as the body of the request, a “headers” key which is a JSON object containing the header key/value pairs and a “save_to_var” key inside which a variable name can be specified in which the response is saved. The response is also saved as a JSON object whose keys are “statusCode”, “body” and “headers” of response.
Note, the text column can contain any of the variables which are populated before sending the request. The same is true for the query params inside the URL too. Any variables captured during the chat can be included Inside the URL too. One common use case is to send the variables as JSON in the text column which can be processed further. An example of this is given below.

Example:

ID Type Text Goto
5.1 Dialogue Thank You! you will start receiving alerts soon.
SendRequest-POST-https://webhook.com/catch {“headers”: {“Authorization”: “Basic token_here”}, “body”: {“phone”: “{{vars.number}}”}}

Here is a sample Chatbot spreadsheet that uses SendRequest

Request Demo