Skip to content

Latest commit

 

History

History
102 lines (76 loc) · 3.29 KB

File metadata and controls

102 lines (76 loc) · 3.29 KB

Liane Webhooks

A small app for proxying Facebook Webhooks


This small app serves as a proxy for Facebook Webhooks, allowing you to configure multiple services to receive the data.

Currently supports only Page webhooks, which also includes the Messenger Platform.

Supported Methods

  • Meteor DDP
  • HTTP
  • Socket.io (soon)

Configuring

At config/ directory you can create production.json and development.json configuration files to setup your variables.

Example config file:

{
  "url": "<site url>",
  "localtunnel": {
    "host": "<your localtunnel server (optional)>",
    "subdomain": "<your subdomain (optional)>"
  },
  "facebook": {
    "clientId": "<client id>",
    "clientSecret": "<client secret>",
    "webhookVerifyToken": "<secret verification token>",
    "fields": ["<array of webhook fields to subscribe to>"]
  },
  "services": {
    "liane": {
      "type": "ddp",
      "methodName": "webhookUpdate",
      "fields": ["feed"],
      "host": "localhost",
      "port": 3000,
      "token": "token_here"
    },
    "another": {
      "type": "http",
      "fields": [
        "messages",
        "message_deliveries",
        "message_reads",
        "messaging_postbacks",
        "messaging_optins"
      ],
      "url": "http://localhost:4000/subscriptions",
      "token": "token_here",
      "test": true
    }
  }
}

URL

Your webhook url. Must be SSL for receiving Facebook webhook data. Can be blank if running in development mode with npm run watch.

Localtunnel

Optional for custom localtunnel server.

Facebook (required)

  • clientId: Facebook App client ID
  • clientSecret: Facebook App client secret
  • webhookVerifyToken: Webhook subscription verification token. This is randomly generated on app startup if not set
  • fields: list of fields to subscribe to

Services (required)

Services that will receive the data.

  • type: can be ddp or http
  • methodName: name of the service's DDP method (DDP only)
  • fields: list of fields that this service should receive data from. Leave empty to receive from all subscribed fields
  • host: hostname for DDP client connection (DDP only)
  • port: port for DDP client connection (DDP only)
  • url: full URL for HTTP connection (HTTP only)
  • token: token provided by the service for security validation
  • test: if set to true, errors coming from this service won't be sent as response to Facebook (keeps Facebook from reattempting to send the data)

Usage

WARNING: By running the app, it will automatically set your app webhook URL with the list of fields provided for subscription and a generated verification token.

Install dependencies by running npm install.

You can run in development mode using npm run watch, which will automatically start a localtunnel with nodemon, configure your site url and set the webhook configuration to your Facebook app.

Production

For production use, make sure you have all the config settings set.

Build by running npm run build then serve with npm run serve.