mebots

1.2.0 • Public • Published

mebots

NPM package summary for mebots

A JavaScript interface to the MeBots API.

Usage

First install with npm or your favorite package manager:

npm install mebots

Import into your project:

const mebots = require('mebots');
// Alternative:
const Bot = require('mebots').Bot;
// If you choose this option, simply instantiate the bot as `new Bot(...)` below.

Instantiate your bot by passing the shortname and token:

// var or let should work too
const bot = new mebots.Bot('your_bot_shortname', 'token (at top of page while editing your bot)')

You will likely want to store the token in an environment variable or config file of some sort. At any rate, don't commit it to GitHub! :)

Finally, use a promise structure to fetch the instance and post a message, using the id field to fulfill the bot_id key as discussed in GroupMe's documentation here!

bot.getInstance(receivedGroupId).then((instance) => {
    options = { // the parameters you're passing to
        // ...
        'bot_id': instance.id,
    };
    // Perform request just like you normally would!
});

Feel free to open an issue if you need help!

See this repository for an example of a fully-functioning GroupMe bot in JavaScript using the MeBots API.

Authorship

Erik Boesen

Readme

Keywords

Package Sidebar

Install

npm i mebots

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

4 kB

Total Files

4

Last publish

Collaborators

  • erikboesen