SMS Integration with NPM

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')(<strong>process.env.DASHBOT_API_KEY</strong>).sms;

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

Message Format​

You can send the following fields:

Log whenever your webhook is called​

const messageForDashbot = {
  "text": "Hi, bot",
  "userId": "+14155551234",
  "platformJson": {
    "whateverJson": "any JSON specific to your platform can be stored here -- if you are using Twilio, put the req.body here"
  }
};
<strong>dashbot.logIncoming(messageForDashbot);</strong>

Whenever you send a message, log the response​

const messageForDashbot = {
  "text": "Hello, my human pet",
  "userId": "+14155551234",
  "platformJson": {
    "whateverJson": "any JSON specific to your platform can be stored here -- if you are using Twilio, put the req.body here"
  }
};
<strong>dashbot.logOutgoing(messageForDashbot);</strong>

Example

View sample code for complete example.