2.0.0 • Published 9 years ago

calamarble-fb-webhook-verify v2.0.0

Weekly downloads
10
License
MIT
Repository
github
Last release
9 years ago

Facebook Messenger Token Verification

A function to handle token verifications of the Facebook Messenger Platform format.

Usage

With express.js

import express from 'express';
import { apiEndpoint } from 'calamarble-fb-webhook-verify';

const expressConfig = {
    port: 8088,
    getPath: '/fbwebhook',
    messages: {
        serverRunning: (port) => `Server running on port ${port}`
    }
}
const fbVerifyConfig = {
    verifyToken: 'YOUR_VERIFY_TOKEN',
    messages: {
        validationFailed: 'Failed validation.'
    }
}
const config = Object.assign({}, expressConfig, fbVerifyConfig);
const app = express();
const getEndPoint = apiEndpoint(config);
app.get(config.getPath, getEndPoint);
app.listen(config.port, () => console.log(`Server running on port ${config.port}`));

With claudia-api-builder

import ApiBuilder from 'claudia-api-builder';
import { apiEndpoint as fbWebhookGet} from 'calamarble-fb-webhook-verify';

const api = new ApiBuilder();
const config = {
    verifyToken: 'YOUR_VERIFY_TOKEN',
    messages: {
        validationFailed: 'Failed validation.'
    }
}

api.get('/fbwebhook', fbWebhookGet(config));

export { api as default };

With AWS Lambda and the "Method Request passthrough" template of API Gateway

import { handler as handlerConstructor } from './path/to/calamarble-fb-webhook-verify/index';

const config = {
    verifyToken: 'YOUR_VERIFY_TOKEN',
    messages: {
        validationFailed: 'Failed validation.'
    }
}
const handler = handlerConstructor(config);
export { handler };

See CONTRIBUTING.md for screenshots of the API Gateway setup on AWS

2.0.0

9 years ago

1.0.16

9 years ago

1.0.15

10 years ago

1.0.13

10 years ago

1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago