botmetrics-kik-middleware v0.0.1
Botmetrics Middleware for kik-node
Botmetrics is an analytics and engagement platform for chatbots.
Installation
Add botmetrics-kik-middleware to your package.json
$ npm install --save botmetrics-kik-middlewareUsage
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-keyRequire botmetrics-kik-middleware and use the middleware in your bot like so:
// Initialize the middleware with Botmetrics API Key, Botmetrics Bot ID
// and your Kik bot's username
var BotmetricsMiddleware = require('botmetrics-kik-middleware').BotmetricsMiddleware({
botId: process.env.BOTMETRICS_BOT_ID,
apiKey: process.env.BOTMETRICS_API_KEY,
username: process.env.KIK_USERNAME
});
// Configure the bot API endpoint, details for your bot
let bot = new Bot({
username: process.env.KIK_USERNAME,
apiKey: process.env.KIK_API_KEY,
baseUrl: process.env.KIK_WEBHOOK_HOST,
});
// Use the middleware
bot.use(BotmetricsMiddleware.receive);
bot.outgoing(BotmetricsMiddleware.send);Examples
To run the example, run the following command:
$ PORT=3000 node examples/example.jsMake sure you have ngrok running which tunnels to port 3000 (and set
the hostname of your ngrok tunnel in the environment variable
KIK_WEBHOOK_HOST.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/botmetrics/botmetrics-kik-middleware. 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.
9 years ago