GithubHelp home page GithubHelp logo

messaging-apis's Introduction

Messaging APIs

Build Status coverage License: MIT

Messaging APIs is a mono repo which collects APIs needed for bot development.

It helps you build your bots using similar API for multiple platforms, e.g. Messenger, LINE. Learn once and make writing cross-platform bots easier.

Packages

Package Version Platform
messaging-api-messenger npm Messenger
messaging-api-line npm LINE
messaging-api-slack npm Slack
messaging-api-telegram npm Telegram

Usage

Messenger

Install messaging-api-messenger package from the registry:

npm i --save messaging-api-messenger

or

yarn add messaging-api-messenger

Then, create a MessengerClient to call Messenger APIs:

import { MessengerClient } from 'messaging-api-messenger';

// get accessToken from facebook developers website
const client = MessengerClient.connect(accessToken);

client.sendText(userId, 'Hello World')
  .then(() => {
    console.log('sent');
  });

Check out full API documentation for more detail information.

LINE

Install messaging-api-line package from the registry:

npm i --save messaging-api-line

or

yarn add messaging-api-line

Then, create a LINEClient to call LINE APIs:

import { LINEClient } from 'messaging-api-line';

// get accessToken and channelSecret from LINE developers website
const client = LINEClient.connect(accessToken, channelSecret);

client.pushText(userId, 'Hello World')
  .then(() => {
    console.log('pushed');
  });

Check out full API documentation for more detail information.

Slack

Install messaging-api-slack package from the registry:

npm i --save messaging-api-slack

or

yarn add messaging-api-slack

Then, create a SlackClient to call Slack APIs:

import { SlackClient } from 'messaging-api-slack';

// get webhook URL by adding a Incoming Webhook integration to your team.
// https://my.slack.com/services/new/incoming-webhook/
const client = SlackClient.connect('https://hooks.slack.com/services/XXXXXXXX/YYYYYYYY/zzzzzZZZZZ');

client.sendText('Hello World')
  .then(() => {
    console.log('sent');
  });

Check out full API documentation for more detail information.

Telegram

Install messaging-api-telegram package from the registry:

npm i --save messaging-api-telegram

or

yarn add messaging-api-telegram

Then, create a TelegramClient to call Telegram APIs:

import { TelegramClient } from 'messaging-api-telegram';

// get accessToken from telegram [@BotFather](https://telegram.me/BotFather)
const client = TelegramClient.connect('12345678:AaBbCcDdwhatever');

client.sendMessage(chatId, 'Hello World')
  .then(() => {
    console.log('sent');
  });

Check out full API documentation for more detail information.

Documentation

Change Log

Every release, along with the migration instructions, is documented on the CHANGELOG.md file.

License

MIT © Yoctol

messaging-apis's People

Contributors

chentsulin avatar evenchange4 avatar homerchen19 avatar kaddopur avatar kpman avatar tw0517tw avatar

Watchers

 avatar

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.