Socket
Book a DemoInstallSign in
Socket

@kiina/facebook-tools

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kiina/facebook-tools

This package contains some Facebook tools, which can be used to help in the use of some of Facebook's APIs.

latest
Source
npmnpm
Version
2.1.4
Version published
Maintainers
1
Created
Source

Facebook Tools

This package contains some Facebook tools, which can be used to help in the use of some of Facebook's APIs.

Installation

npm install @kiina/facebook-tools

Table of contents

  • Broadcast
  • ThreadControl

Broadcast

Offers resources to access the Facebook's Broadcast API.

Usage

const { Broadcast } = require('@kiina/facebook-tools');

const broadcast = new Broadcast('<FB-PAGE-TOKEN>');

Methods

createLabel(labelName: string): Promise

Creates a new label to use on broadcasts.

const labelName = 'LABEL_NAME';
await broadcast.createLabel(labelName);

addUserToLabel(userId: string, labelName: string): Promise

Add an user to an existing label.

const labelName = 'LABEL_NAME';
await broadcast.addUserToLabel('<FB-USER-ID>', labelName);

removeUserFromLabel(userId: string, labelName: string): Promise

Removes an user from an existing label.

const labelName = 'LABEL_NAME';
await broadcast.removeUserFromLabel('<FB-USER-ID>', labelName);

sendMessages(messages: FacebookMessage[], labelName: string): Promise

Sends a list of messages to an existing label.

const labelName = 'LABEL_NAME';
const messages = [
  { text: 'hello world' }
];

await broadcast.sendMessages(messages, labelName);

Reference: FacebookMessage - https://developers.facebook.com/docs/messenger-platform/reference/send-api/#message

Thread Control

Offers resources to access the Facebook's Thread Control API.

Usage

const { ThreadControl } = require('@kiina/facebook-tools');

const threadControl = new ThreadControl('<FB-PAGE-TOKEN>');

Methods

passThreadControl(userId: string, targetAppId: string, metadata?: string): Promise

Passes the control of the conversation with the given user to a different app.

const userId = '2153176358137612538';
const targetAppId = '539126537823531312';
const metadata = 'some payload you might want to send'
await threadControl.passThreadControl(userId, targetAppId, metadata);

takeThreadControl(userId: string, metadata?: string): Promise

Takes back the control of the conversation with the given user.

const userId = '2153176358137612538';
const metadata = 'some payload you might want to send'
await threadControl.takeThreadControl(userId, metadata);

FAQs

Package last updated on 03 Sep 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.