Socket
Socket
Sign inDemoInstall

serverless-facebook-messenger-bot

Package Overview
Dependencies
446
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    serverless-facebook-messenger-bot

Serverless backend for Facebook Messenger Bot.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Serverless Facebook Messenger Bot

Build Status

Serverless backend for Facebook Messenger Bot

Install

You need to have installed the Serverless Framework (version 0.5.2 or higher) and you're using Node.js v4.0+.

1. Init project

sls project install serverless-facebook-messenger-bot

2. Setup FB App

Follow quickstart but start with Step 1 and Step 3 to get Page Access Token before deploying backend.

3. Set variables

sls variables set -k PAGE_ACCESS_TOKEN
sls variables set -k VERIFY_TOKEN

VERIFY_TOKEN is used for subsciption verification.

4. Deploy backend app

Deploy all functions and endpoints

sls function deploy --all
sls endpoint deploy --all

Now you have public webhook URL.

5. Setup Webhook

Back to the FB App Quickstart and verify your webhook.

6. Subscribe the App to the Page

curl -ik -X POST "https://graph.facebook.com/v2.6/me/subscribed_apps?access_token=<PAGE_ACCESS_TOKEN>"

7. Send messages

Go to your Facebook Page and send a message to it. The response will come from your brand new servreless backend! See screenshots in the Quickstart

Running Tests

npm test

Develop

Want to add some logic into bot's responses? Take a look in functions/webhook/handlers/

Deploy

sls function deploy --all

Running localy

npm run offline

and you can send POST requests to http://localhost:3000/webhook

To get an idea about the POST body, enable logging:

sls variables set -k LOG_WEBHOOK_MESSAGES -v true

deploy, send few messages via Messenger and see the logs:

sls function logs webhook

Keywords

FAQs

Last updated on 27 Apr 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc