Yoctol/messaging-apis

Name: messaging-apis

Owner: YOCTOL INFO INC.

Description: Messaging APIs for multi-platform

Created: 2017-05-10 12:38:40.0

Updated: 2018-01-17 15:48:38.0

Pushed: 2018-01-12 06:45:40.0

Homepage:

Size: 1116

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Messaging APIs

Build Status 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.

If you are looking for a framework to build your bots, Bottender may suit for your needs. It is built on top of Messaging APIs and provides some powerful features for bot building.

Packages

| Package | Version | Platform | |———|———|————-| | messaging-api-messenger | npm | Messenger | | messaging-api-line | npm | LINE | | messaging-api-slack | npm | Slack | | messaging-api-telegram | npm | Telegram | | messaging-api-viber | npm | Viber | | messaging-api-wechat | npm | WeChat |

Usage
Messenger

Messenger

Install messaging-api-messenger package from the registry:

i --save messaging-api-messenger

or

 add messaging-api-messenger

Then, create a MessengerClient to call Messenger APIs:

t { MessengerClient } = require('messaging-api-messenger');

et accessToken from facebook developers website
t client = MessengerClient.connect(accessToken);

nt.sendText(userId, 'Hello World').then(() => {
nsole.log('sent');

Check out full API documentation for more detail information.

LINE

LINE

Install messaging-api-line package from the registry:

i --save messaging-api-line

or

 add messaging-api-line

Then, create a LineClient to call LINE APIs:

t { LineClient } = require('messaging-api-line');

et accessToken and channelSecret from LINE developers website
t client = LineClient.connect(accessToken, channelSecret);

nt.pushText(userId, 'Hello World').then(() => {
nsole.log('pushed');

Check out full API documentation for more detail information.

Slack

Slack

Install messaging-api-slack package from the registry:

i --save messaging-api-slack

or

 add messaging-api-slack

Then, create a SlackOAuthClient or SlackWebhookClient to call Slack APIs:

t { SlackOAuthClient } = require('messaging-api-slack');

et access token by setup OAuth & Permissions function to your app.
ttps://api.slack.com/docs/oauth
t client = SlackOAuthClient.connect(
oxb-000000000000-xxxxxxxxxxxxxxxxxxxxxxxx'


nt.postMessage('#random', 'Hello World').then(() => {
nsole.log('sent');

s
t { SlackWebhookClient } = require('messaging-api-slack');

et webhook URL by adding a Incoming Webhook integration to your team.
ttps://my.slack.com/services/new/incoming-webhook/
t client = SlackWebhookClient.connect(
ttps://hooks.slack.com/services/XXXXXXXX/YYYYYYYY/zzzzzZZZZZ'


nt.sendText('Hello World').then(() => {
nsole.log('sent');

Check out full API documentation for more detail information.

Telegram

Telegram

Install messaging-api-telegram package from the registry:

i --save messaging-api-telegram

or

 add messaging-api-telegram

Then, create a TelegramClient to call Telegram APIs:

t { TelegramClient } = require('messaging-api-telegram');

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

nt.sendMessage(chatId, 'Hello World').then(() => {
nsole.log('sent');

Check out full API documentation for more detail information.

Viber

Viber

Install messaging-api-viber package from the registry:

i --save messaging-api-viber

or

 add messaging-api-viber

Then, create a ViberClient to call Viber APIs:

t { ViberClient } = require('messaging-api-viber');

et authToken from the "edit info" screen of your Public Account.
t client = ViberClient.connect(authToken);

nt.sendText(userId, 'Hello World').then(() => {
nsole.log('sent');

Check out full API documentation for more detail information.

WeChat

WeChat

Install messaging-api-wechat package from the registry:

i --save messaging-api-wechat

or

 add messaging-api-wechat

Then, create a WechatClient to call Wechat APIs:

t { WechatClient } = require('messaging-api-wechat');

et appId, appSecret from???????-??-?????page
t client = WechatClient.connect(appId, appSecret);

nt.sendText(userId, 'Hello World').then(() => {
nsole.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


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.