Twitter Intent Tracking

With Intents, you can roll up similar messages your bot sends to quickly see the combined metrics.

Here is how we define an intent:

  • intent – object – (optional)
    • name – string
    • inputs – array
      • input – object
        • name – string
        • value – string

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.

Adding an Intent for an inbound message

Example: "What is the weather in San Francisco?"

{
  "text": "What is the weather in San Francisco?",
  "userId": "USERIDHERE123123",
  "platformJson": {
    "twitterJson": "place JSON from Twitter here"
  }
}

Define Intent

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"
    }
  ]
}

Append the Intent JSON to the original message

{
  "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"
      }
    ]
  }
}

Post the complete message to Dashbot

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

Sample cURL

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=10.1.1-rest&type=incoming&apiKey=API_KEY_HERE'

Adding an Intent for an outbound message

Example: "The weather is 68 degrees and sunny."

{
  "text": "The weather is 68 and sunny.",
  "userId": "USERIDHERE123123",
  "platformJson": {
    "twitterJson": "place JSON from Twitter here"
  }
}

Define Intent

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"
    }
  ]
}

Append the Intent JSON to the original message

{
  "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"
  },
  "intent": {
    "name": "WEATHER_RESPONSE",
    "inputs": [
      {
        "name": "forecast",
        "value": "68 and sunny"
      }
    ]
  }
}

Post the complete message to Dashbot

https://tracker.dashbot.io/track?platform=twitter&v=10.1.1-rest&type=outgoing&apiKey=API_KEY_HERE

Sample cURL

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=10.1.1-rest&type=outgoing&apiKey=API_KEY_HERE'
Close Menu