API

How to connect SnatchBot to API

Developers can use SnatchBot API to add messaging and conversational capabilities to their software.

To start with, please create your bot first (you can use an existing bot as well):

After this is done, go to the bot’s settings and open the Channels section. In the next panel, you will see the ‘Other/API’ channel:

3164

Next, enter the particular App ID and App Secret that you intend to use to connect to the channel, then the Deploy button becomes available to activate the channel.
Note: the App ID and Secret can contain up to 55 characters, Latin letters and numbers.

3148

Click the ‘Request Configure’ tab to proceed. Open Postman (to build a GET request) and copy the Get messages value:

790

After that, add ‘user_id’ and ‘message_id’ parameters to your request. The ‘user_id’ parameter can be taken from the Reports (User column), the same as the ‘message_id’ (if you do not have any messages, you can set this value to 0):

1662

Here is the final GET request:

https://snatchbot.me/channels/api/api/id28233/app9YRCO5v8BwrjMu1G/apsNEm2qoIDY6Di7CzC23GhYe9F59pqVBVh?user_id=user.1553a463a21bde95.7kQLaUOl&message_id=0

After sending the request, the following JSON response will be received:

1609

To send a message via API, use the POST method. Remove the ‘message_id’ parameter from the previous request, and then add a message in the Body section, for instance {"message": "Hi"}. After sending a request, you will receive a JSON response, to which you can reply using the same POST method:

1602 1619

Information about the API requests is displayed in the bot’s reports.

🚧

Some restrictions

  1. Facebook attributes are not available for API
  2. The following plugins are not available for API: eBay, Giphy.
  3. The Persistent Menu is not available for API.
  4. Users can not subscribe/unsubscribe to RSS feeds, also the “Share” button is not available.

Next Steps

How to access your bot beyond Snatchbot.me.