JSPM

  • Created
  • Published
  • Downloads 32
  • Score
    100M100P100Q87253F
  • License MIT

A library wrapping requests to the Beekeeper API for easy access

Package Exports

  • beekeeper

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (beekeeper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Beekeeper JavaScript SDK

Build Status A npm package providing easy access to the Beekeeper universe.

Beekeeper is a mobile-first communication platform that reaches every shift, location, and language through real-time messaging and targeted streams. Managers keep frontline teams productive and turnover low by automating workflows, while leveraging an analytics dashboard to measure engagement. Beekeeper integrates with existing operational systems and makes them accessible in one central portal.

Learn more about Beekeeper at https://beekeeper.io.

Installation

Install npm package with:

npm install --save beekeeper

or

yarn add beekeeper

Tenant Access

In order to use this package on a tenant, you will need to gather two pieces of information:

  • Tenant URL e.g. https://<tenant>.beekeeper.io
  • Bot Access Key e.g. fae00bbc-b0f6-4ace-8e13-7d53b58076e1

Read more about it in the Help Center.

ChatBot

An easy way to get started with the Beekeeper SDK is a chatbot. An example is shown below:

const { ChatBot } = require('beekeeper');

const credentials = {
    tenantURL: 'https://<tenant>.beekeeper.io',
    token: '540a254c-ea8b-4ae7-a456-d8437b7314d6',
};

const bot = ChatBot.withCredentials(credentials);


bot.on('message', (message, ctx) => {
    // Listen to new messages and reply with received text
    ctx.replyWithText(message.text);
});

bot.on('started', () => {
    // Listen for started event and indicate readiness
    console.log('Bot is started!');
})

// Start listening for events
bot.start();

More examples can be found in the examples folder.

SDK API

The included Beekeeper SDK holds multiple data repositories. By calling these methods, you will receive a promise resolving with a the result of the operation.

Messages

sdk.Messages.create(message) creates a new message

Profiles

sdk.Profiles.get(username) gets a profile by username sdk.Profiles.list(filter) returns a list of users with optional filter that can be {limit: 50}. This is an ADMIN resource.

Conversations

sdk.byProfile(profile) gets a conversation by profile

Posts

sdk.Posts.create(post) create a new post

Streams

sdk.Streams.list() gets a list of streams

In addition its possible to get the current user by sdk.getMe().