1.0.4 • Published 6 years ago

@enablo/workplace-webhooks v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

workplace-webhooks

A simple node module to help bootstrap developing with Workplace by Facebook webhooks. It takes care of things like the webhooks verification, X-hub-signature validaton, etc.

Install

$ npm install @enablo/workplace-webhooks

Usage

Create a simple app

The example below creates a basic app which listens for requests on /webhook.

const WorkplaceWebhooks = require('@enablo/workplace-webhooks');

const workplaceWebhooks = new WorkplaceWebhooks(process.env.WORKPLACE_APP_SECRET,
  process.env.WORKPLACE_VERIFY_TOKEN);

workplaceWebhooks.page((message) => {
  // Do something with the page message
});

const port = process.env.PORT || 3000;
workplaceWebhooks.listen(port)
  .then(() => console.info(`🖥️  Server listenting on port ${port}.`))
  .catch(err => console.error(err.message));

Examples

A basic example of how to implement the webhooks is available under /examples.

1.0.4

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago