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:
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.
Click the ‘Request Configure’ tab to proceed. Open Postman (to build a GET request) and copy the Get messages value:
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):
Here is the final GET request:
After sending the request, the following JSON response will be received:
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:
Information about the API requests is displayed in the bot’s reports.
Some restrictions
- Facebook attributes are not available for API
- The following plugins are not available for API: eBay, Giphy.
- The Persistent Menu is not available for API.
- Users can not subscribe/unsubscribe to RSS feeds, also the “Share” button is not available.
Updated about 5 years ago