Giter VIP home page Giter VIP logo

slack-incoming-facebook's Introduction

slack-incoming-facebook

Slack Incoming WebHook for Facebook

Install

npm install -g slack-incoming-facebook

CLI

slack-incoming-facebook \
  --config /path/to/config.json \
  --db /path/to/db.json \
  --env environment

config.json

{
  "development": {
    "facebook": {
      "id": "[Organization Screen Name]",
      "token": "[OAuth Access Token]",
      "types": ["post types to include (optional)"]
    },
    "slack": { "see below" }
  }
}

The username, icon_url and channel keys are optional and take effect only if the hook is a Custom Integration. These 3 keys have no effect for bundled OAuth Apps.

Single hook:

"slack": {
  "hook": "[Hook URL]",
  "username": "[App Name]",
  "icon_url": "[App Avatar]",
  "channel": "[Target #channel or @user]"
}

Multiple hooks with a common username, icon_url and channel configuration:

"slack": {
  "hook": [
    "[Hook URL 1]",
    "[Hook URL 2]"
  ],
  "username": "[App Name]",
  "icon_url": "[App Avatar]",
  "channel": "[Target #channel or @user]"
}

Multiple hooks with separate username, icon_url and channel configuration:

"slack": [
  {
    "hook": "[Hook URL 1]",
    "username": "[App Name]",
    "icon_url": "[App Avatar]",
    "channel": "[Target #channel or @user]"
  },
  {
    "hook": [
      "[Hook URL 2]",
      "[Hook URL 3]"
    ],
    "username": "[App Name]",
    "icon_url": "[App Avatar]",
    "channel": "[Target #channel or @user]"
  }
]

db.json

{
  "development": {
    "timestamp": 0
  },
  "production": {
    "timestamp": 0
  }
}

Crontab

# Run on every 15 min:
*/15 * * * * node slack-incoming-facebook [params] >> slack-incoming-facebook.log

API

var hook = require('slack-incoming-facebook')

hook({
  config: require('config.json'),
  db: require('db.json'),
  dpath: '/absolute/path/to/db.json',
  env: 'development'
})
.then((responses) => {
  responses.forEach(([res, body]) => {
    console.log(new Date().toString(), res.statusCode, body)
  })
})
.catch((err) => console.error(new Date().toString(), err))

slack-incoming-facebook's People

Stargazers

 avatar

Watchers

 avatar  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.