Send your Response data directly after a certain step answer

If you need to send the response data directly after a step answer is given without waiting for the whole bot to complete, you can use the onAnswer callback in the Advanced Initialization options on the Advanced tab (at the bottom):

     onAnswer: function(results, question, storedData) {
           // prepare answers by index
            var answersByIndex = {};
            results.answers.forEach(function(item) {
                answersByIndex[item.question.index] = {
                    value: item.value.value,
                    text: item.text && item.text.answers_text ? (typeof item.text.answers_text === "object" ? item.text.answers_text[0] : item.text.answers_text).toString().trim() : ""
            // check if we have an answer to step 4
            if (answersByIndex[4]) {
                quriobot.ajax (
                    function(responseText) {
                    // data sent to zapier webhook
                        "first_name": answersByIndex[2].value,
                        "last_name": answersByIndex[3].value,
                        "email": answersByIndex[4].value

Not e: In the example code above we assume here that you need to send data to Zapier after an answer to Step 4 and Step 2, 3, 4 are first name, last name, and email steps, which will be sent as first_name, last_name, and email variables to Zapier

Note2: Keep in mind that the Step numbers in lines 20, 21, and 22 in the example above are the actual number the end-user gets them and not necessarily how you configured in the Quriobot Control Room. (in case you are using jumps in your bot)

The code snippet above might look like some mysterious algebra, so to explain a little on what is happening there and make it easier for you to modify to your own needs:

Step 1. Copy-paste the code above to the Advanced Initialization on the Advanced tab

Step 2. Configure after which Step the bot will send response directly

In the code snippet above, in row 12, the response will be sent directly after the bot goes past Step 4.

Step 3: Configure to which service the response should be sent via a so-called webhook.

In the code snippet, we use the Zapier service to send our data. This webhook can be retrieved by searching for “webhook” in the Zapier service.

Step 4: Configure which data should be sent along to that third-party service.

In this code snippet, we defined three variables “first_name”, “last_name”, and “email” which get their data from Steps 2, 3, and 4.

Result: If we execute this example and go past step 4, the Zapier webhook will be triggered and will receive three variables (first_name, last_name, email) with the values that were supplied by your users in the bot in steps 2, 3, and 4.

Edit this page

See also