Universal Integration with REST API
Using the Universal integration, you can use Dashbot with any conversational user interface.
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
There are two integration points as outlined below.
Message Format
You can send the following fields:
- <tt>text</tt> – *string* – (required)- <tt>userId</tt> – *string* – (required) – should be the SAME userId for both incoming and outgoing messages this is NOT the bot’s user ID- <tt>intent</tt> – *object* – (optional)- <tt>name</tt> – *string*- <tt>inputs</tt> – *array*- <tt>input</tt> – *object*- <tt>name</tt> – *string*- <tt>value</tt> – *string*- confidence – *float (optional) –* the confidence value for your intent from 0.0 (completely uncertain) to 1.0 (completely certain)- <tt>images</tt> – *array* – (optional)- - <tt>url</tt> – *string*- <tt>buttons</tt> – *array* – (optional)- <tt>button</tt> – *object*- <tt>id</tt> – *string*- <tt>label</tt> – *string*- <tt>value</tt> – *string*- <tt>postback</tt> – *object* (optional)- <tt>buttonClick</tt> – *object*- <tt>buttonId</tt> – *string*- <tt>platformJson</tt> – *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.- If you use these exact field names, they will be used in the expected places on Dashbot reports:- firstName- lastName- locale- timezone- gender- sessionId – *string* (optional) – if you do not want Dashbot to calculate sessions based on the 5-minute message timeout, you may send sessionId instead.
1. When your bot receives a message
When your bot receives a message, post the data to the following endpoint:
https://tracker.dashbot.io/track?platform=universal&v=10.1.1-rest&type=incoming&apiKey=API_KEY_HERE
Make sure to set the ‘Content-Type’ header to ‘application/json’
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"}}
Sample cURL
curl -X POST -H "Content-Type: application/json" <br></br>-d '{"text":"Hi, bot","userId":"USERIDHERE123123","platformJson":{"whateverJson":"any JSON specific to your platform can be stored here"}}' <br></br>'https://tracker.dashbot.io/track?platform=universal&v=11.1.0-rest&type=incoming&apiKey=API_KEY_HERE'
Note
This is just an example — we accept all the fields listed at the top of the page.
2. When your bot sends a message
When your bot sends a message, POST to the following endpoint:
https://tracker.dashbot.io/track?platform=universal&v=11.1.0-rest&type=outgoing&apiKey=API_KEY_HERE
Make sure to set the ‘Content-Type’ header to ‘application/json’
The data to POST should pass the following data:
{"text": "Hello, my human pet","userId": "USERIDHERE123123","platformJson": {"whateverJson": "any JSON specific to your platform can be stored here"}}
Sample cURL
curl -X POST -H "Content-Type: application/json" <br></br>-d '{"text":"Hello, my human pet","userId":"USERIDHERE123123","platformJson":{"whateverJson":"any JSON specific to your platform can be stored here"}}' <br></br>'https://tracker.dashbot.io/track?platform=universal&v=11.1.0-rest&type=outgoing&apiKey=API_KEY_HERE'
Sample JSON with optional fields
{"text": "Hello, my human pet","userId": "USERIDHERE123123","intent": {"name": "HELLO"},"images": [{"url": "https://media.giphy.com/media/mIZ9rPeMKefm0/giphy.gif"}],"platformUserJson": {"firstName": "Will","lastName": "Robinson","locale": "en_US","timezone": "-8","gender": "male"},"platformJson": {"whateverJson": "any JSON specific to your platform can be stored here"}}
Note
This is just an example — we accept all the fields listed at the top of the page.
Example
View a complete example.