Bots that cannot connect to external APIs and integrate into business frameworks probably will stay nothing but a toy. To make your bot really useful for your customers we’ve developed an integration system through the JSON module.
You can also use this block to call external API endpoints (Zapier is a perfect example) and fetch data from these endpoints to your bot.
Example of the JSON block usage
Paste the external script address to the “URL” field in block settings and choose the calling method (GET or POST). Add parameters that you’d like to send with the call (either hard-coded or from user attributes). If necessary, you can also add headers to JSON requests (for example, for authorization).
As a result, this block will save key-value pairs received in JSON response to user attributes and move on to the block that is connected to the SUCCESS tab. On any error, blocks connected to the ERROR button will be triggered.
In the example above bot is collecting the user’s name, email address, and phone number and sends this information to Zapier webhook listener, so that it can be added to CRM or Google Sheets.
Let’s suppose that external script returns JSON of this structure (here’s an example from Zapier Webhooks integration):
Example JSON response from an API endpoint
After this call you will have new attributes in your chatbot: $status, $attempt, $id and $request_id. These values can be used in any other block since then (TEXT, DATA, SWITCH, etc).
Currently, Activechat supports plain JSON output with no nested objects. Objects and arrays will be supported soon.
- send data to Google Drive
- send e-mails
- push data to CRM
- publish Twitter and Facebook posts
- create tasks in Google Tasks
- send conversion data to Facebook
- make requests to Firebase and PostgresSQL
- send SMS
- …and do a thousand things more with Zapier.com