Socket
Socket
Sign inDemoInstall

facebook-messenjs

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

facebook-messenjs

API wrapper for Facebook Messenger inspired by discord.js


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

Facebook MessenJS

Facebook MessenJS is an API wrapper for Facebook Messenger inspired by discord.js that allows you to interact with Facebook Messenger's API. The bot was programmed with an object-oriented approach so that people can program their Facebook Messenger chatbots with ease.

Installation

npm i facebook-messenjs

Simple Chatbot

const { Client } = require('facebook-messenjs');

const bot = new Client({
    pageToken: "PAGE_TOKEN_FROM_FACEBOOK",
    verifyToken: "YOUR_VERIFY_TOKEN",
    appID: "APP_ID_FROM_FACEBOOK"
});

// Allows Facebook to know that you set the URL of the bot properly
bot.on('webhookVerify', verification => {
    if (verification.success) {
        console.log("Webhook verified with Facebook successfully!");
    } else {
        console.log("Webhook verified with Facebook failed! ;-;");
    }
});

// Processes messages from people who message the Facebook page
bot.on("messages", message => {
    message.sender.send("Hi!");
});

// Turns on the bot at port 5566
bot.listen(5566, () => {
    console.log(`Facebook Messenger chatbot listening at http://localhost:${bot.port}`);
})

Keywords

FAQs

Package last updated on 29 May 2022

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