Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fbmessenger-node-bot

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fbmessenger-node-bot

Module for creating FB Messenger bots.

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by800%
Maintainers
1
Weekly downloads
 
Created
Source

fbmessenger-node-bot

Arhitecture based on https://github.com/Naltox/telegram-node-bot

Very powerful module for creating Facebook Messenger bots.

Get started

Now let's write simple bot!

'use strict'
const FBMB = require('fbmessenger-node-bot'),
    FBMessenger = FBMB.FBMessenger,
    FBMessengerBaseController = FBMB.FBMessengerBaseController,
    TextCommand = FBMB.TextCommand

let fb = new FBMessenger(config.get('fb.PAGE_ACCESS_TOKEN'), { 
    webhook: config.get('fb.webhook'),
    validation_token: config.get('fb.VALIDATION_TOKEN')
})

class PingController extends FBMessengerBaseController {
    /**
     * @param {Scope} $
     */
    pingHandler($) {
        $.api.sendTextMessage('pong')
    }

    get routes() {
        return {
            'pingCommand': 'pingHandler'
        }
    }
}

fb.router
    .when(
        new TextCommand('ping', 'pingCommand'),
        new PingController()
    )

Keywords

FAQs

Package last updated on 15 Dec 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc