Documentation

Facebook NotHandled Intent

It is very important to understand when a user says something to your bot that it does not understand.

By passing Dashbot the NotHandled Intent, you can take advantage of the Not Handled report. There are two ways to set the NotHandled Intent:

NPM Integration: Adding a NotHandled Intent

Prior to the dashbot.logOutgoing() call.

Prior to the dashbot.logIncoming(request.body) call, add this line:

dashbot.setNotHandled();

REST Integration: Adding a NotHandled Intent

If you are using the REST integration, set the intent name to NotHandled to make use of the special NotHandled reports.

Example: For Incoming Messages

{
"object": "page",
"entry": [
{
"id": "943703799078240",
"time": 1610433652560,
"messaging": [
{
"sender": {
"id": "1018952661536494"
},
"recipient": {
"id": "943703799078240"
},
"timestamp": 1610433652560,
"message": {
"mid": "mid.1468531733396:9242db91fea253e355",
"seq": 978,
"text": "This is a message that is not handled."
}
}
]
}
]
}

Attach the NotHandled Intent

{
"name": "NotHandled"
}

Append the Intent JSON to the original message

{
"object": "page",
"entry": [
{
"id": "943703799078240",
"time": 1610433652560,
"messaging": [
{
"sender": {
"id": "1018952661536494"
},
"recipient": {
"id": "943703799078240"
},
"timestamp": 1610433652560.
"message": {
"mid": "mid.1468531733396:9242db91fea253e355",
"seq": 978,
"text": "This is a message that is not handled."
},
"intent": {
"name": "NotHandled"
}
}
]
}
]
}

Post the complete message to Dashbot

https://tracker.dashbot.io/track?platform=facebook&v=11.1.0-rest&type=incoming&apiKey=API_KEY_HERE

Make sure to set the ‘Content-Type’ header to ‘application/json’

Sample cURL

curl -X POST -H "Content-Type: application/json"
-d '{"object":"page","entry":[{"id":"943703799078240","time":1610433652560,"messaging":[{"sender":{"id":"1018952661536494"},"recipient":{"id":"943703799078240"},"timestamp": 1610433652560,"message":{"mid":"mid.1468531733396:9242db91fea253e355","seq":978,"text":"This is a message that is not handled."},"intent":{"name":"NotHandled"}}]}]}'
'https://tracker.dashbot.io/track?platform=facebook&v=11.1.0-rest&type=incoming&apiKey=API_KEY_HERE

Note
Notice that the Intent object is for each message in the array of messages (which is inside the entries array).