libfb
TypeScript icon, indicating that this package has built-in type declarations

2.3.5 • Public • Published

libfb-js

Facebook chat MQTT library for Node.js

npm   npm   love

Example usage

Echo bot

const { Client } = require('libfb')
const client = new Client()
client.login('username', 'password').then(() => {
  client.on('message', message => {
    console.log('Got a message!')
    console.log(message.message)
    client.sendMessage(message.threadId, message.message)
  })
})

Chat greeting

const { Client } = require('libfb')
const client = new Client()
client.login('username', 'password').then(() => {
  client.on('participantsAddedToGroupThreadEvent', async event => {
    const user = await client.getUserInfo(event.participantIds[0])
    client.sendMessage(event.threadId, `Hello, ${user.name}!`)
  })
})

Documentation

See here

Updating from 1.x.x

const { login } = require('libfb')
login('username', 'password').then(client => {
  ...
})

becomes

const { Client } = require('libfb')
const client = new Client()
client.login('username', 'password').then(() => {
  ...
})

Disclaimer

We do not guarantee that this product will work correctly. Use only with whitehat accounts for research/educational purposes. We are not responsible for getting banned on Facebook.
MQTT connection logic was based on bitlbee-facebook.
All product and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
"Facebook" is a registered trademark of Facebook, Inc., used under license agreement.

Readme

Keywords

none

Package Sidebar

Install

npm i libfb

Weekly Downloads

108

Version

2.3.5

License

MIT

Unpacked Size

1.59 MB

Total Files

312

Last publish

Collaborators

  • bjornskjald