Dashbot

Twitter Documentation

Twitter Documentation

Welcome to the Twitter documentation for Dashbot! Integrating Dashbot into your Twitter DM bot is quick and easy.

If you have any questions, comments, or suggestions, please feel free to contact us.

Node Integration

Create a bot API key

Each bot needs its own API key for tracking.

Create a bot to get an API key.

Install Dashbot via NPM

npm install --save dashbot

Include Dashbot

Use the API key created above.

const dashbot = require('dashbot')(process.env.DASHBOT_API_KEY).twitter;

Whenever your bot sends, or receives data, log to Dashbot

Message Format

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
  • images – array – (optional)
    • image – object
      • url – string
  • buttons – array – (optional)
    • button – object
      • id – string
      • label – string
      • value – string
  • postback – object (optional)
    • buttonClick – object
      • buttonId – string
  • platformJson – object (optional) – send ALL of your platform-specific JSON here. It will be available for viewing in your transcripts.

Log whenever your webhook is called

const messageForDashbot = {
"text": "Blue Bird",
"userId": "1234858592",
"platformJson": {
"direct_message_events": [
{
"type": "message_create",
"id": "1234858589",
"created_timestamp": "1392078023603",
"message_create": {
"target": {
"recipient_id": "1234858592"
},
"sender_id": "3805104374",
"source_app_id": "268278",
"message_data": {
"text": "Blue Bird",
"entities": {
"hashtags": [],
"symbols": [],
"urls": [],
"user_mentions": []
},
"quick_reply_response": {
"type": "options",
"metadata": "external_id_2"
},
"attachment": {
"type": "media",
"media": {}
}
}
}
}
],
"users": {
"1234858592": {
"id": "1234858592",
"created_timestamp": "1415320482361",
"name": "TwitterDev",
"screen_name": "TwitterDev",
"location": "Internet",
"description": "Developer and Platform Relations @Twitter. We are developer advocates. We can't answer all your questions, but we listen to all of them",
"protected": false,
"verified": true,
"followers_count": 440643,
"friends_count": 1534,
"statuses_count": 2837,
"profile_image_url": "http://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png"
},
"3805104374": {
"id": "3805104374",
"created_timestamp": "1449607341142",
"name": "Furni",
"screen_name": "furni",
"location": "San Francisco, CA",
"description": "Furni is Twitter's example company to showcase new developer features.",
"protected": false,
"verified": false,
"followers_count": 297,
"friends_count": 7,
"statuses_count": 1,
"profile_image_url": "http://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png"
}
},
"apps": {
"268278": {
"id": "268278",
"name": "Twitter Web Client",
"url": "http://twitter.com"
}
}
}
};
dashbot.logIncoming(messageForDashbot);

Whenever you send a message, log the response

const messageForDashbot = {
"text": "Just a normal text DM out.",
"userId": "1234858592",
"platformJson": {
"direct_message_events": [
{
"type": "message_create",
"id": "1244858585",
"created_timestamp": "1492078023507",
"message_create": {
"target": {
"recipient_id": "3805104374"
},
"sender_id": "1234858592",
"source_app_id": "8829219",
"message_data": {
"text": "Just a normal text DM out.",
"entities": {
"hashtags": [],
"symbols": [],
"urls": [],
"user_mentions": []
},
"attachment": {
"type": "media",
"media": {}
}
}
}
}
],
"users": {
"1234858592": {
"id": "1234858592",
"created_timestamp": "1415320482361",
"name": "TwitterDev",
"screen_name": "TwitterDev",
"location": "Internet",
"description": "Developer and Platform Relations @Twitter. We are developer advocates. We can't answer all your questions, but we listen to all of them",
"protected": false,
"verified": true,
"followers_count": 440643,
"friends_count": 1534,
"statuses_count": 2837,
"profile_image_url": "http://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png"
},
"3805104374": {
"id": "3805104374",
"created_timestamp": "1449607341142",
"name": "Furni",
"screen_name": "furni",
"location": "San Francisco, CA",
"description": "Furni is Twitter's example company to showcase new developer features.",
"protected": false,
"verified": false,
"followers_count": 297,
"friends_count": 7,
"statuses_count": 1,
"profile_image_url": "http://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png"
}
},
"apps": {
"8829219": {
"id": "8829219",
"name": "Furni",
"url": "https://twitter.com/furni"
}
}
}
};
dashbot.logOutgoing(messageForDashbot);

Example

View sample code.



Integration with REST API

Getting Started

If you’re building a Twitter DM bot, here are ome useful resources at Twitter:

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 a few integration points as outlined below.

Note
Overall, there are a few pieces of data that we need you to pull out of the Twitter JSON, and then the rest of the Twitter JSON goes in “platformJson”

1. When your bot sends a message with buttons

From the Twitter Example, when your bot sends a message, it will look like something like this:

Post to the following endpoint:

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

Make sure to set the ‘Content-Type’ header to ‘application/json’ and to replace API_KEY_HERE with your api key.

The data to POST should pass the following data:

{
"text": "What's your favorite type of bird?",
"userId": "1234858592",
"buttons": [
{
"id": "1",
"label": "Red Bird",
"value": "external_id_1"
},
{
"id": "2",
"label": "Blue Bird",
"value": "external_id_2"
}
],
"platformJson": {
"direct_message_events": [
{
"type": "message_create",
"id": "1234858585",
"created_timestamp": "1392078023507",
"message_create": {
"target": {
"recipient_id": "3805104374"
},
"sender_id": "1234858592",
"source_app_id": "8829219",
"message_data": {
"text": "What's your favorite type of bird?",
"entities": {
"hashtags": [],
"symbols": [],
"urls": [],
"user_mentions": []
},
"quick_reply": {
"type": "options",
"options": [
{
"label": "Red Bird",
"metadata": "external_id_1"
},
{
"label": "Blue Bird",
"metadata": "external_id_2"
},
{
"label": "Black Bird",
"metadata": "external_id_3"
},
{
"label": "White Bird",
"metadata": "external_id_4"
}
]
},
"attachment": {
"type": "media",
"media": {}
}
}
}
}
],
"users": {
"1234858592": {
"id": "1234858592",
"created_timestamp": "1415320482361",
"name": "TwitterDev",
"screen_name": "TwitterDev",
"location": "Internet",
"description": "Developer and Platform Relations @Twitter. We are developer advocates. We can't answer all your questions, but we listen to all of them",
"protected": false,
"verified": true,
"followers_count": 440643,
"friends_count": 1534,
"statuses_count": 2837,
"profile_image_url": "http://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png"
},
"3805104374": {
"id": "3805104374",
"created_timestamp": "1449607341142",
"name": "Furni",
"screen_name": "furni",
"location": "San Francisco, CA",
"description": "Furni is Twitter's example company to showcase new developer features.",
"protected": false,
"verified": false,
"followers_count": 297,
"friends_count": 7,
"statuses_count": 1,
"profile_image_url": "http://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png"
}
},
"apps": {
"8829219": {
"id": "8829219",
"name": "Furni",
"url": "https://twitter.com/furni"
}
}
}
}

Sample cURL

curl -X POST -H "Content-Type: application/json"
-d '{"text":"Whats your favorite type of bird?","userId":"1234858592","buttons":[{"id":"1","label":"Red Bird","value":"external_id_1"},{"id":"2","label":"Blue Bird","value":"external_id_2"}],"platformJson":{"direct_message_events":[{"type":"message_create","id":"1234858585","created_timestamp":"1392078023507","message_create":{"target":{"recipient_id":"3805104374"},"sender_id":"1234858592","source_app_id":"8829219","message_data":{"text":"What'"'"'s your favorite type of bird?","entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[]},"quick_reply":{"type":"options","options":[{"label":"Red Bird","metadata":"external_id_1"},{"label":"Blue Bird","metadata":"external_id_2"},{"label":"Black Bird","metadata":"external_id_3"},{"label":"White Bird","metadata":"external_id_4"}]},"attachment":{"type":"media","media":{}}}}}],"users":{"1234858592":{"id":"1234858592","created_timestamp":"1415320482361","name":"TwitterDev","screen_name":"TwitterDev","location":"Internet","description":"Developer and Platform Relations @Twitter. We are developer advocates. We can'"'"'t answer all your questions, but we listen to all of them","protected":false,"verified":true,"followers_count":440643,"friends_count":1534,"statuses_count":2837,"profile_image_url":"http://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png","profile_image_url_https":"https://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png"},"3805104374":{"id":"3805104374","created_timestamp":"1449607341142","name":"Furni","screen_name":"furni","location":"San Francisco, CA","description":"Furni is Twitter'"'"'s example company to showcase new developer features.","protected":false,"verified":false,"followers_count":297,"friends_count":7,"statuses_count":1,"profile_image_url":"http://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png","profile_image_url_https":"https://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png"}},"apps":{"8829219":{"id":"8829219","name":"Furni","url":"https://twitter.com/furni"}}}}'
'https://tracker.dashbot.io/track?platform=twitter&v=11.1.0-rest&type=outgoing&apiKey=API_KEY_HERE'

Notice, you must replace the placeholder API_KEY_HERE above with your api key.

2. When your bot receives a message


From the Twitter Example, when your bot sends a message, it will look like something like this:

Post to the following endpoint:

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

Make sure to set the ‘Content-Type’ header to ‘application/json’ and to replace API_KEY_HERE with your api key.

The data to POST should pass the following data:

{
"text": "Blue Bird",
"userId": "1234858592",
"platformJson": {
"direct_message_events": [
{
"type": "message_create",
"id": "1234858589",
"created_timestamp": "1392078023603",
"message_create": {
"target": {
"recipient_id": "1234858592"
},
"sender_id": "3805104374",
"source_app_id": "268278",
"message_data": {
"text": "Blue Bird",
"entities": {
"hashtags": [],
"symbols": [],
"urls": [],
"user_mentions": []
},
"quick_reply_response": {
"type": "options",
"metadata": "external_id_2"
},
"attachment": {
"type": "media",
"media": {}
}
}
}
}
],
"users": {
"1234858592": {
"id": "1234858592",
"created_timestamp": "1415320482361",
"name": "TwitterDev",
"screen_name": "TwitterDev",
"location": "Internet",
"description": "Developer and Platform Relations @Twitter. We are developer advocates. We can't answer all your questions, but we listen to all of them",
"protected": false,
"verified": true,
"followers_count": 440643,
"friends_count": 1534,
"statuses_count": 2837,
"profile_image_url": "http://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png"
},
"3805104374": {
"id": "3805104374",
"created_timestamp": "1449607341142",
"name": "Furni",
"screen_name": "furni",
"location": "San Francisco, CA",
"description": "Furni is Twitter's example company to showcase new developer features.",
"protected": false,
"verified": false,
"followers_count": 297,
"friends_count": 7,
"statuses_count": 1,
"profile_image_url": "http://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png"
}
},
"apps": {
"268278": {
"id": "268278",
"name": "Twitter Web Client",
"url": "http://twitter.com"
}
}
}
}

Sample cURL

curl -X POST -H "Content-Type: application/json"
-d '{"text":"Blue Bird","userId":"1234858592","platformJson":{"direct_message_events":[{"type":"message_create","id":"1234858589","created_timestamp":"1392078023603","message_create":{"target":{"recipient_id":"1234858592"},"sender_id":"3805104374","source_app_id":"268278","message_data":{"text":"Blue Bird","entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[]},"quick_reply_response":{"type":"options","metadata":"external_id_2"},"attachment":{"type":"media","media":{}}}}}],"users":{"1234858592":{"id":"1234858592","created_timestamp":"1415320482361","name":"TwitterDev","screen_name":"TwitterDev","location":"Internet","description":"Developer and Platform Relations @Twitter. We are developer advocates. We cant answer all your questions, but we listen to all of them","protected":false,"verified":true,"followers_count":440643,"friends_count":1534,"statuses_count":2837,"profile_image_url":"http://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png","profile_image_url_https":"https://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png"},"3805104374":{"id":"3805104374","created_timestamp":"1449607341142","name":"Furni","screen_name":"furni","location":"San Francisco, CA","description":"Furni is Twitter'"'"'s example company to showcase new developer features.","protected":false,"verified":false,"followers_count":297,"friends_count":7,"statuses_count":1,"profile_image_url":"http://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png","profile_image_url_https":"https://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png"}},"apps":{"268278":{"id":"268278","name":"Twitter Web Client","url":"http://twitter.com"}}}}'
'https://tracker.dashbot.io/track?platform=twitter&v=11.1.0-rest&type=incoming&apiKey=API_KEY_HERE'

3. When your bot sends a text message out

When your bot sends a message, POST to the following endpoint:

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

Make sure to set the ‘Content-Type’ header to ‘application/json’ and to replace API_KEY_HERE with your api key.

The data to POST should pass the following data:

{
"text": "Just a normal text DM out.",
"userId": "1234858592",
"platformJson": {
"direct_message_events": [
{
"type": "message_create",
"id": "1244858585",
"created_timestamp": "1492078023507",
"message_create": {
"target": {
"recipient_id": "3805104374"
},
"sender_id": "1234858592",
"source_app_id": "8829219",
"message_data": {
"text": "Just a normal text DM out.",
"entities": {
"hashtags": [],
"symbols": [],
"urls": [],
"user_mentions": []
},
"attachment": {
"type": "media",
"media": {}
}
}
}
}
],
"users": {
"1234858592": {
"id": "1234858592",
"created_timestamp": "1415320482361",
"name": "TwitterDev",
"screen_name": "TwitterDev",
"location": "Internet",
"description": "Developer and Platform Relations @Twitter. We are developer advocates. We can't answer all your questions, but we listen to all of them",
"protected": false,
"verified": true,
"followers_count": 440643,
"friends_count": 1534,
"statuses_count": 2837,
"profile_image_url": "http://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png"
},
"3805104374": {
"id": "3805104374",
"created_timestamp": "1449607341142",
"name": "Furni",
"screen_name": "furni",
"location": "San Francisco, CA",
"description": "Furni is Twitter's example company to showcase new developer features.",
"protected": false,
"verified": false,
"followers_count": 297,
"friends_count": 7,
"statuses_count": 1,
"profile_image_url": "http://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png"
}
},
"apps": {
"8829219": {
"id": "8829219",
"name": "Furni",
"url": "https://twitter.com/furni"
}
}
}
}

Sample cURL

curl -X POST -H "Content-Type: application/json"
-d '{"text":"Just a normal text DM out.","userId":"1234858592","platformJson":{"direct_message_events":[{"type":"message_create","id":"1244858585","created_timestamp":"1492078023507","message_create":{"target":{"recipient_id":"3805104374"},"sender_id":"1234858592","source_app_id":"8829219","message_data":{"text":"Just a normal text DM out.","entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[]},"attachment":{"type":"media","media":{}}}}}],"users":{"1234858592":{"id":"1234858592","created_timestamp":"1415320482361","name":"TwitterDev","screen_name":"TwitterDev","location":"Internet","description":"Developer and Platform Relations @Twitter. We are developer advocates. We cant answer all your questions, but we listen to all of them","protected":false,"verified":true,"followers_count":440643,"friends_count":1534,"statuses_count":2837,"profile_image_url":"http://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png","profile_image_url_https":"https://pbs.twimg.com/profile_images/530814764687949824/npQQVkq8_normal.png"},"3805104374":{"id":"3805104374","created_timestamp":"1449607341142","name":"Furni","screen_name":"furni","location":"San Francisco, CA","description":"Furni is Twitter'"'"'s example company to showcase new developer features.","protected":false,"verified":false,"followers_count":297,"friends_count":7,"statuses_count":1,"profile_image_url":"http://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png","profile_image_url_https":"https://pbs.twimg.com/profile_images/653712801219805185/S4LvoO9b_normal.png"}},"apps":{"8829219":{"id":"8829219","name":"Furni","url":"https://twitter.com/furni"}}}}'
'https://tracker.dashbot.io/track?platform=twitter&v=11.1.0-rest&type=outgoing&apiKey=API_KEY_HERE'

Notice, you must replace the placeholder API_KEY_HERE above with your api key.



Advanced Usage

Twitter Intent Tracking

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:

  • 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=11.1.0-rest&type=incoming&apiKey=API_KEY_HERE

Make sure to set the ‘Content-Type’ header to ‘application/json’ and to replace API_KEY_HERE with your api key.

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

Notice, you must replace the placeholder API_KEY_HERE above with your api key.

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

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=11.1.0-rest&type=outgoing&apiKey=API_KEY_HERE

Make sure to set the ‘Content-Type’ header to ‘application/json’ and to replace API_KEY_HERE with your api key.

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

Notice, you must replace the placeholder API_KEY_HERE above with your api key.



Tracking Events in a Conversation

Events

You may wish to track certain events in conversations, such as:

  • External URL Clicks
  • Social Shares
  • Revenue
  • Anything else…

JSON Format

The JSON that you can send to track an event is:

  • name – string (required)
  • userId – string (required)
  • conversationId – string (optional)
  • type – enum (required)
    • customEvent
    • revenueEvent
    • shareEvent
    • pageLaunchEvent

For each event type, you can pass additional properties:
customEvent

  • extraInfo – object (optional)

revenueEvent

  • amount – number (required)
  • referenceNumber – string (optional)
  • metadata – object (optional)

pageLaunchEvent

  • extraInfo – object (optional)

shareEvent

  • sharedMessage – object (optional)

referralEvent

  • name – string (required)
  • ref – string the referral tag (optional)
  • source – string the referral source (eg. ADS, WEB) (optional)
  • ad_id – string an ID to identify the ad (optional)
  • referer_uri – string the URI that sent the referer(optional)

Tracking Custom Events

Post to the endpoint

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

Make sure to set the ‘Content-Type’ header to ‘application/json’ and to replace API_KEY_HERE with your api key.

The data to POST should pass the following data:

{
"name": "trackMeEvent",
"type": "customEvent",
"userId": "967295313370594",
"extraInfo": {
"start": 1500504070512,
"difference": 374,
"end": 1500504070886
}
}

Sample cURL

curl -X POST -H "Content-Type: application/json"
-d '{"name":"trackMeEvent","type":"customEvent","userId":"967295313370594","extraInfo":{"start":1500504070512,"difference":374,"end":1500504070886}}'
'https://tracker.dashbot.io/track?platform=twitter&v=11.1.0-rest&type=event&apiKey=API_KEY_HERE'

Notice, you must replace the placeholder API_KEY_HERE above with your api key.

Tracking Revenue Events

Post to the endpoint

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

Make sure to set the ‘Content-Type’ header to ‘application/json’ and to replace API_KEY_HERE with your api key.

The data to POST should pass the following data:

{
"name": "boughtSandwich",
"type": "revenueEvent",
"userId": "967295313370594",
"amount": 17.45,
"metadata": {
"productName": "Ham Sandwich",
"sku": "abc123123"
}
}

Sample cURL

curl -X POST -H "Content-Type: application/json"
-d '{"name":"boughtSandwich","type":"revenueEvent","userId":"967295313370594","amount":17.45,"metadata":{"productName":"Ham Sandwich","sku":"abc123123"}}'
'https://tracker.dashbot.io/track?platform=twitter&v=11.1.0-rest&type=event&apiKey=API_KEY_HERE'

Notice, you must replace the placeholder API_KEY_HERE above with your api key.

Tracking Page Launch Events

Post to the endpoint

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

Make sure to set the ‘Content-Type’ header to ‘application/json’ and to replace API_KEY_HERE with your api key.

The data to POST should pass the following data:

{
"name": "Launched Detail Page",
"type": "pageLaunchEvent",
"userId": "967295313370594",
"extraInfo": {
"url": "https://www.dashbot.io/"
}
}

Sample cURL

curl -X POST -H "Content-Type: application/json"
-d '{"name":"Launched Detail Page","type":"pageLaunchEvent","userId":"967295313370594","extraInfo":{"url":"https://www.dashbot.io/"}}'
'https://tracker.dashbot.io/track?platform=twitter&v=11.1.0-rest&type=event&apiKey=API_KEY_HERE'

Tracking Share Events

Post to the endpoint

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

Make sure to set the ‘Content-Type’ header to ‘application/json’ and to replace API_KEY_HERE with your api key.

The data to POST should pass the following data:

{
"name": "sharedLink",
"type": "shareEvent",
"userId": "967295313370594",
"sharedMessage": {
"text": "come check out this bot"
}
}

Sample cURL

curl -X POST -H "Content-Type: application/json"
-d '{"name":"sharedLink","type":"shareEvent","userId":"967295313370594","sharedMessage":{"text":"come check out this bot"}}'
'https://tracker.dashbot.io/track?platform=twitter&v=11.1.0-rest&type=event&apiKey=API_KEY_HERE'

Notice, you must replace the placeholder API_KEY_HERE above with your api key.

Edit this page on GitHub