botkit-middleware-botmetrics
v0.0.4
Published
Botkit Middleware for Botmetrics
Downloads
3
Readme
Botmetrics Middleware for Botkit
Botmetrics is an analytics and engagement platform for chatbots.
Installation
Add botkit-middleware-botmetrics
to your package.json
$ npm install --save botkit-middleware-botmetrics
Usage
Register your bot with Botmetrics. Once you have done so, navigate to "Bot Settings" and find out your Bot ID and API Key.
Set the following environment variables with the Bot ID and API Key respectively.
BOTMETRICS_BOT_ID=your-bot-id
BOTMETRICS_API_KEY=your-api-key
Require botkit-middleware-botmetrics
and use the middleware in your bot like so:
require('botkit-middleware-botmetrics')({
botmetricsBotId: process.env.BOTMETRICS_BOT_ID,
botmetricsApiKey: process.env.BOTMETRICS_API_KEY,
controller: controller
});
Slack
For a detailed Slack example, look at examples/slack.js.
Set the appropriate environment variables SLACK_BOT_TOKEN
and then run
`node examples/slack.js).
For a detailed Facebook example, look at examples/facebook.js.
Set the appropriate environment variables PAGE_ACCESS_TOKEN
and VERIFY_TOKEN
and then run `node examples/slack.js).
Setting your API Host (for Self-Hosting)
If you are using your own self-hosted version of Botmetrics, remember to
set the BOTMETRICS_API_HOST
environment variable to your host (If you
have hosted your Botmetrics instance at
https://my-botmetrics-instance.herokuapp.com
, set
BOTMETRICS_API_HOST
to https://my-botmetrics-instance.herokuapp.com
.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/botmetrics/botkit-middleware-botmetrics. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.