Giter Club home page Giter Club logo

relay's Introduction

relay

Bot user that can send and receive messages to and from different users

npm version Dependency Status

Build Status Coverage Status Code Climate Join the chat at https://gitter.im/nshimiye/relay

Installation

npm install bot-relay

usage

  • Instance initialization
const relay = require('bot-relay');
let token = '<slack bot token>'; //@TODO add url to get this token
let slackRelay = relay.slackRelay(token);

slackRelay.connect().then( relayInstance => {
  // send messages to known users
  // broadcast messages to all users
  // post messages to channels
}, connectionError => {
  // you can try to reconnect
  // you can verify with slack to make sure your token is still valid
});
  • Turn the bot on and off.
slackRelay.connect(); // return promise - resolve with relay instance
slackRelay.disconnect(); // return promise - resolve with success message
  • Relay provide a "notify" method that takes in the user-name or channel-name
relayInstance.notify('<user-1>', 'user_typing');
  • Send message to slack user
relayInstance.send('Hi there!', '<user-1>');
  • Post in a slack channel
relayInstance.post('Hello! I am alive :)', '<channel-1>');
  • Send message to slack user
relayInstance.broadcast('Sorry for spamming!', ['<user-1>', '<user-2>']);

relay's People

Contributors

fuse-mars avatar nshimiye avatar gitter-badger avatar

Watchers

James Cloos avatar  avatar

Forkers

gitter-badger

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.