Intents are an optional, advanced feature.
With Intents, you can roll up similar messages your bot sends to quickly see the combined metrics.
Here is how we define an intent:
Intents can be sent for either inbound or outbound messages. Place the intent object at the root level of the JSON that you send for each inbound or outbound message.
{
"text": "What is the weather in San Francisco?",
"userId": "USERIDHERE123123",
"platformJson": {
"twitterJson": "place JSON from Twitter here"
}
}
The message “What is the weather in San Francisco?” maps to the WEATHER_QUERY Intent with the “city” entity “San Francisco”
{
"name": "WEATHER_QUERY",
"inputs": [
{
"name": "city",
"value": "San Francisco"
}
]
}
{
"text": "What is the weather in San Francisco?",
"userId": "USERIDHERE123123",
"platformJson": {
"twitterJson": "place JSON from Twitter here"
},
<strong>"intent": {
"name": "WEATHER_QUERY",
"inputs": [
{
"name": "city",
"value": "San Francisco"
}
]
}</strong>
}
https://tracker.dashbot.io/track?platform=twitter&v=11.1.0-rest&type=incoming&apiKey=<strong>API_KEY_HERE</strong>
Make sure to set the ‘Content-Type’ header to ‘application/json’
curl -X POST -H "Content-Type: application/json"
-d '{"text":"What is the weather in San Francisco?","userId":"USERIDHERE123123","platformJson":{"twitterJson":"place JSON from Twitter here"},"intent":{"name":"WEATHER_QUERY","inputs":[{"name":"city","value":"San Francisco"}]}}'
'https://tracker.dashbot.io/track?platform=twitter&v=11.1.0-rest&type=incoming&apiKey=<strong>API_KEY_HERE</strong>'
Note
Notice that the Intent object is for each message in the array of messages (which is inside the entries array).
{
"text": "The weather is 68 and sunny.",
"userId": "USERIDHERE123123",
"platformJson": {
"twitterJson": "place JSON from Twitter here"
}
}
The message “The weather is 68 degrees and sunny.” maps to the WEATHER_RESPONSE Intent with the “forecast” entity “68 and sunny”
{
"name": "WEATHER_RESPONSE",
"inputs": [
{
"name": "forecast",
"value": "68 and sunny"
}
]
}
{
"qs": {
"access_token": "<YOUR ACCESS TOKEN>"
},
"uri": "https://graph.facebook.com/v2.6/me/messages",
"json": {
"message": {
"text": "The weather is 68 degrees and sunny."
},
"recipient": {
"id": "1018952661536494"
}
},
"method": "POST",
"responseBody": {
"recipient_id": "1018952661536494",
"message_id": "mid.1470371655004:4727480467538e9450"
},
<strong>"intent": {
"name": "WEATHER_RESPONSE",
"inputs": [
{
"name": "forecast",
"value": "68 and sunny"
}
]
}</strong>
}
https://tracker.dashbot.io/track?platform=twitter&v=11.1.0-rest&type=outgoing&apiKey=<strong>API_KEY_HERE</strong>
Make sure to set the ‘Content-Type’ header to ‘application/json’
curl -X POST -H "Content-Type: application/json"
-d '{"qs":{"access_token":""},"uri":"https://graph.facebook.com/v2.6/me/messages","json":{"message":{"text":"The weather is 68 degrees and sunny."},"recipient":{"id":"1018952661536494"}},"method":"POST","responseBody":{"recipient_id":"1018952661536494","message_id":"mid.1470371655004:4727480467538e9450"},"intent":{"name":"WEATHER_RESPONSE","inputs":[{"name":"forecast","value":"68 and sunny"}]}}'
'https://tracker.dashbot.io/track?platform=twitter&v=11.1.0-rest&type=outgoing&apiKey=<strong>API_KEY_HERE</strong>'