You can update Airtable records with data coming from your chatbot using our Integromat - Make integration. More than that, you can update the records by doing calculations.
Let's say that you are conducting a survey about voting intentions.
You need to update your voting results every time someone completes the survey.
So you can create a chatbot that asks who is the favourite candidate using predefined answers.
Then, you'll do the mapping to find the candidate's name in the Airtable database and add a "+1" to his current number of votes.
Here are the steps to follow:
Create your Airtable
Create a column for your candidates, another one for the results and a last one for the record ids you'll need for your Integromat / Make integration.
Here is the formula you need:
RECORD_ID()
Create your Joonbot
Now, create your survey using a button block that asks who is your favourite candidate. Save the answer under the variable name you want.
Here I chose "vote".
Then, add a webhook block after the user chooses the candidate he wants to vote for or at the end of the conversation.
Create your Integromat / Make scenario
1. Create a new scenario and add the trigger custom webhook
2. Create a webhook by clicking on the "add" button and name it the way you want.
3. Copy the Webhook URL
4. Go into your Joonbot and click on your webhook block and on the "edit my webhooks" button.
5. Click on the "Create webhook" button, name your webhook, choose POST as webhook method, paste the Webhook URL in the field below and save.
6. Now, click on the Joonbot logo on the upper left and go back to your chatbot. Click on your Webhook block and choose the webhook you just created.
Choose "No" for the Asynchronous option.
7. Now, go back to Integromat / Make and add the new action to your scenario: the Airtable Search Records.
8. Connect your Airtable account, and pick your database and table. Now you need to create a formula that will find the record that matches with the candidate selected.
The variable vote you created in Joonbot contains the name of the candidate, and you have a column in Airtable with the candidate's names.
So all you need to do is to create the formula that gives the record when the variable "vote" matches one of the records of your Airtable.
Here is the formula I used:
( {Candidate} = '1.vote' )
⚠️ Don't forget the {} and the ''!
9. Add a new action into your Integromat / Make scenario: Update a record in Airtable.
Pick your base and table. You only want to update the record with the new vote.
You'll get access to Airtable data thanks to the previous action you created in Integromat / Make.
So you can fill the Record ID and Candidate fields with the variables at your disposal.
For the nb_votes section, you need to add the new vote to the current number of votes.
Here is the formula you can use:
sum(nb_votes; 1)
10. Add a new action into your Integromat / Make scenario: the Wehbook response.
⚠️ Joonbot webhook block is expecting a JSON, so you need to send back a JSON format.
You don't need to give any specific data to your Joonbot so here is what you can add:
{"hook_response": "ok"}
11. Time to test now!
Within Integromat / Make, activate your integration. Make sure you have the right option selected: "Immediately as data arrives".
If something doesn't work
If you make some changes in your Joonbot, don't forget to redetermine your data structure in your custom webhook block.
Re-run to see if everything is ok now.
Also, maybe there is something wrong with your Webhook block in Joonbot. First, check that your webhook block has a webhook selected and that the URL is correct.
If your chatbot is ok and you tested your Integromat integration, and it's a success, then open a tab and paste the webhook URL. Maybe there is an issue with the JSON payload.
Comments
0 comments
Please sign in to leave a comment.