Webchat Integration with REST API
Create a bot API key
Each bot needs its own API key for tracking.
Create a bot to get an API key.
Integrate the REST API
Use the API key created above.
You can send the following fields:
- text – string – (required)
- userId – string – (required) – should be the SAME userId for both incoming and outgoing messages this is NOT the bot’s user ID
- intent – object – (optional)
- name – string
- inputs – array
- input – object
- name – string
- value – string
- input – object
- confidence – float (optional) - the confidence value for your intent from 0.0 (completely uncertain) to 1.0 (completely certain)
- images – array – (optional)
- image – object
- url – string
- image – object
- buttons – array – (optional)
- button – object
- id – string
- label – string
- value – string
- button – object
- postback – object (optional)
- buttonClick – object
- buttonId – string
- buttonClick – object
- platformJson – object (optional) – send your platform-specific message JSON here. It will be available for viewing in your transcripts. Reporting on this data is available with our enterprise plan.
- platformUserJson – object (optional) – send any user-specific information (ie. zipcode, A/B test group, etc). Reporting on this data is available from audience builder, with our enterprise plan.
When your bot receives a message, POST to this endpoint:
https://tracker.dashbot.io/track?platform=webchat&v=11.1.0-rest&type=incoming&apiKey=API_KEY_HERE
The data to POST should pass the following data:
{"text": "Hi, bot","userId": "USERIDHERE123123","platformJson": {"whateverJson": "any JSON specific to your platform can be stored here"}}
When your bot sends a message, POST to the tracker endpoint:
{"text": "Hello, my human pet","userId": "USERIDHERE123123","platformJson": {"whateverJson": "any JSON specific to your platform can be stored here"}}