cloud-chat-bridge
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

cloud-chat-bridge

Framework for Google Cloud Functions to bridge communications in chat services to others, such as

  • LINE -> Slack
  • Slack -> LINE <- coming soon

Example of your index.js

const bridge = require("cloud-chat-bridge");

// Your secret variables, see following for details
const vars = require("./secret.json");
const app = bridge.init({vars});

// Your rules to bridge messages, see following for details
const rules = require("./rules");
const endpoint = app.webhook(rules);

exports.webhook = endpoint;

Example rules

module.exports = [
  {
    // From any groups of LINE
    "source": {
      "group": /.*/
    },
    // To "random" channel of Slack
    "destination": {
      "service": "Slack",
      "channels": ["random"]
    }
  }
]

Variables you might need

secret.json, like this

{
  "LINE_CHANNEL_SECRET": "XXXXXX",
  "LINE_CHANNEL_ACCESS_TOKEN": "XXX",
  "SLACK_INCOMING_WEBHOOK_URL": "https://hooks.slack.com/services/XXX/ZZZ"
}
  • LINE_CHANNEL_SECRET
    • can be get when you create provider and bot channel in LINE developer console.
  • LINE_CHANNEL_ACCESS_TOKEN
    • can be created when you create provider and bot channel in LINE developer console.
  • SLACK_INCOMING_WEBHOOK_URL
    • can be created when you enable incoming-webhook in Slack console.

How to deploy your index.js to Google Cloud Functions

gcloud functions deploy webhook_line --trigger-http

See links below for more information

Readme

Keywords

none

Package Sidebar

Install

npm i cloud-chat-bridge

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

55.5 kB

Total Files

65

Last publish

Collaborators

  • otiai10