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.
Paste 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 request (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 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):
After this call you will have new attributes in your chatbot: $status, $attempt, $id and $request_id. Their 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.
Using with Zapier / Integromat
One of the most common use cases for the JSON block is Zapier or Integromat integration. Use Webhooks by Zapier to trigger Zaps that will be able to achieve multiple tasks:
- 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