Dashbot

Webchat Integration

Webchat Integration

Welcome to the Webchat documentation for Dashbot!

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).webchat;

Whenever your bot sends or receives data, log to Dashbot

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 you receive a message:

const messageForDashbot = {
"text": "Hi, bot",
"userId": "USERIDHERE123123",
"platformJson": {
"whateverJson": "any JSON specific to your platform can be stored here"
}
};
dashbot.logIncoming(messageForDashbot);

Log whenever you send a message:

const messageForDashbot = {
"text": "Hello, my human pet",
"userId": "USERIDHERE123123",
"platformJson": {
"whateverJson": "any JSON specific to your platform can be stored here"
}
};
dashbot.logOutgoing(messageForDashbot);


REST Integration

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

Use the API key created above.

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
    • confidence – float (optional) - the confidence value for your intent from 0.0 (completely uncertain) to 1.0 (completely certain)
  • 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 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.

When your bot receives a message, POST to this endpoint:

https://tracker.dashbot.io/track?platform=webchat&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": "Hi, bot",
"userId": "USERIDHERE123123",
"platformJson": {
"whateverJson": "any JSON specific to your platform can be stored here"
}
}

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

{
"text": "Hello, my human pet",
"userId": "USERIDHERE123123",
"platformJson": {
"whateverJson": "any JSON specific to your platform can be stored here"
}
}
Edit this page on GitHub