New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fb-messenger-bot-api2

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fb-messenger-bot-api2 - npm Package Compare versions

Comparing version 4.3.2 to 5.0.0

2

dist/classes/buttons/AttachmentButtonPayload.d.ts
import { ATTACHMENT_TYPE } from '../../enums';
import { AttachmentPayload } from '../../client/Client';
import { AttachmentPayload } from '../../client/FacebookMessagingAPIClient';
import { AttachmentButtonBuilder } from '../../builders/buttons';

@@ -4,0 +4,0 @@ export declare class AttachmentButtonPayload implements AttachmentPayload {

@@ -6,2 +6,4 @@ import { IButton, ProxyData, IQuickReply, IMessageTemplate } from '../interfaces';

sender_action?: string;
messaging_type?: string;
tag?: string;
}

@@ -17,2 +19,6 @@ export interface AttachmentPayload {

}
export interface MessageTag {
messaging_type: string;
tag: string;
}
/**

@@ -60,3 +66,3 @@ * Class representing an Send API client for Facebook. Can leverage existing classes/builders in project to provided

*/
sendTextMessage(id: string, text: string, cb?: Function): Promise<void> | Promise<{}>;
sendTextMessage(id: string, text: string, tag?: MessageTag, cb?: Function): Promise<void> | Promise<{}>;
/**

@@ -70,3 +76,3 @@ * imageUrlOrId can be either URL to Image or ID of previously uploaded one

*/
sendImageMessage(id: string, imageUrlOrId: string, cb?: Function): Promise<void> | Promise<{}>;
sendImageMessage(id: string, imageUrlOrId: string, tag?: MessageTag, cb?: Function): Promise<void> | Promise<{}>;
/**

@@ -80,3 +86,3 @@ * audioUrlOrId can be either URL to audio clip or ID of previously uploaded one

*/
sendAudioMessage(id: string, audioUrlOrId: string, cb?: Function): Promise<void> | Promise<{}>;
sendAudioMessage(id: string, audioUrlOrId: string, tag?: MessageTag, cb?: Function): Promise<void> | Promise<{}>;
/**

@@ -90,3 +96,3 @@ * videoUrlOrId can be either URL to video clip or ID of previously uploaded one

*/
sendVideoMessage(id: string, videoUrlOrId: string, cb?: Function): Promise<void> | Promise<{}>;
sendVideoMessage(id: string, videoUrlOrId: string, tag?: MessageTag, cb?: Function): Promise<void> | Promise<{}>;
/**

@@ -100,3 +106,3 @@ * fileUrlOrId can be either URL to video clip or ID of previously uploaded one

*/
sendFileMessage(id: string, fileUrlOrId: string, cb?: Function): Promise<void> | Promise<{}>;
sendFileMessage(id: string, fileUrlOrId: string, tag?: MessageTag, cb?: Function): Promise<void> | Promise<{}>;
/**

@@ -111,3 +117,3 @@ * Sends any of the Button message types: https://developers.facebook.com/docs/messenger-platform/send-messages/buttons

*/
sendButtonsMessage(id: string, text: string, buttons: IButton[], cb?: Function): Promise<void> | Promise<{}>;
sendButtonsMessage(id: string, text: string, buttons: IButton[], tag?: MessageTag, cb?: Function): Promise<void> | Promise<{}>;
/**

@@ -121,3 +127,3 @@ * Sends any template message type: https://developers.facebook.com/docs/messenger-platform/send-messages/templates

*/
sendTemplateMessage(id: string, templatePayload: IMessageTemplate, cb?: Function): Promise<void> | Promise<{}>;
sendTemplateMessage(id: string, templatePayload: IMessageTemplate, tag?: MessageTag, cb?: Function): Promise<void> | Promise<{}>;
/**

@@ -132,3 +138,3 @@ * Sends Quick Reply message:

*/
sendQuickReplyMessage(id: string, textOrAttachment: string | AttachmentPayload, quickReplies: IQuickReply[], cb?: Function): Promise<void> | Promise<{}>;
sendQuickReplyMessage(id: string, textOrAttachment: string | AttachmentPayload, quickReplies: IQuickReply[], tag?: MessageTag, cb?: Function): Promise<void> | Promise<{}>;
/**

@@ -135,0 +141,0 @@ *

@@ -63,4 +63,4 @@ "use strict";

*/
sendTextMessage(id, text, cb) {
return this.sendDisplayMessage(id, { text }, cb);
sendTextMessage(id, text, tag, cb) {
return this.sendDisplayMessage(id, { text }, tag, cb);
}

@@ -75,4 +75,4 @@ /**

*/
sendImageMessage(id, imageUrlOrId, cb) {
return this.sendUrlOrIdBasedMessage(id, enums_1.ATTACHMENT_TYPE.IMAGE, imageUrlOrId, cb);
sendImageMessage(id, imageUrlOrId, tag, cb) {
return this.sendUrlOrIdBasedMessage(id, enums_1.ATTACHMENT_TYPE.IMAGE, imageUrlOrId, tag, cb);
}

@@ -87,4 +87,4 @@ /**

*/
sendAudioMessage(id, audioUrlOrId, cb) {
return this.sendUrlOrIdBasedMessage(id, enums_1.ATTACHMENT_TYPE.AUDIO, audioUrlOrId, cb);
sendAudioMessage(id, audioUrlOrId, tag, cb) {
return this.sendUrlOrIdBasedMessage(id, enums_1.ATTACHMENT_TYPE.AUDIO, audioUrlOrId, tag, cb);
}

@@ -99,4 +99,4 @@ /**

*/
sendVideoMessage(id, videoUrlOrId, cb) {
return this.sendUrlOrIdBasedMessage(id, enums_1.ATTACHMENT_TYPE.VIDEO, videoUrlOrId, cb);
sendVideoMessage(id, videoUrlOrId, tag, cb) {
return this.sendUrlOrIdBasedMessage(id, enums_1.ATTACHMENT_TYPE.VIDEO, videoUrlOrId, tag, cb);
}

@@ -111,4 +111,4 @@ /**

*/
sendFileMessage(id, fileUrlOrId, cb) {
return this.sendUrlOrIdBasedMessage(id, enums_1.ATTACHMENT_TYPE.FILE, fileUrlOrId, cb);
sendFileMessage(id, fileUrlOrId, tag, cb) {
return this.sendUrlOrIdBasedMessage(id, enums_1.ATTACHMENT_TYPE.FILE, fileUrlOrId, tag, cb);
}

@@ -124,5 +124,5 @@ /**

*/
sendButtonsMessage(id, text, buttons, cb) {
sendButtonsMessage(id, text, buttons, tag, cb) {
const payload = { type: enums_1.ATTACHMENT_TYPE.TEMPLATE, payload: { text, buttons, template_type: 'button' } };
return this.sendAttachmentMessage(id, payload, cb);
return this.sendAttachmentMessage(id, payload, tag, cb);
}

@@ -137,5 +137,5 @@ /**

*/
sendTemplateMessage(id, templatePayload, cb) {
sendTemplateMessage(id, templatePayload, tag, cb) {
const payload = { type: enums_1.ATTACHMENT_TYPE.TEMPLATE, payload: templatePayload };
return this.sendAttachmentMessage(id, payload, cb);
return this.sendAttachmentMessage(id, payload, tag, cb);
}

@@ -151,3 +151,3 @@ /**

*/
sendQuickReplyMessage(id, textOrAttachment, quickReplies, cb) {
sendQuickReplyMessage(id, textOrAttachment, quickReplies, tag, cb) {
let payload;

@@ -160,3 +160,3 @@ if (typeof textOrAttachment === 'string') {

}
return this.sendDisplayMessage(id, payload, cb);
return this.sendDisplayMessage(id, payload, tag, cb);
}

@@ -185,3 +185,3 @@ /**

}
sendUrlOrIdBasedMessage(id, type, urlOrId, cb) {
sendUrlOrIdBasedMessage(id, type, urlOrId, tag, cb) {
let payload;

@@ -194,10 +194,13 @@ if (urlOrId.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g)) {

}
return this.sendAttachmentMessage(id, payload, cb);
return this.sendAttachmentMessage(id, payload, tag, cb);
}
sendAttachmentMessage(id, payload, cb) {
return this.sendDisplayMessage(id, { attachment: payload }, cb);
sendAttachmentMessage(id, payload, tag, cb) {
return this.sendDisplayMessage(id, { attachment: payload }, tag, cb);
}
sendDisplayMessage(id, payload, cb) {
sendDisplayMessage(id, payload, tag, cb) {
const options = this.generateBasicRequestPayload(id);
options.json = Object.assign({}, options.json, { message: payload });
if (tag) {
options.json = Object.assign({}, options.json, { messaging_type: tag.messaging_type, tag: tag.tag });
}
return Utils_1.Utils.sendMessage(options, this.requestData, cb);

@@ -204,0 +207,0 @@ }

{
"name": "fb-messenger-bot-api2",
"version": "4.3.2",
"version": "5.0.0",
"description": "NodeJS Facebook Messenger API for bots to send messages and setup events to Facebook.",

@@ -49,3 +49,3 @@ "main": "dist/index.js",

"type": "git",
"url": "https://github.com/crisboarna/fb-messenger-bot-api.git"
"url": "https://github.com/theguest268/fb-messenger-bot-api.git"
},

@@ -55,5 +55,5 @@ "author": "Cristian Boarna <cristian.boarna@gmail.com>",

"bugs": {
"url": "https://github.com/crisboarna/fb-messenger-bot-api/issues"
"url": "https://github.com/theguest268/fb-messenger-bot-api/issues"
},
"homepage": "https://github.com/crisboarna/fb-messenger-bot-api#readme",
"homepage": "https://github.com/theguest268/fb-messenger-bot-api#readme",
"files": [

@@ -60,0 +60,0 @@ "dist",

# fb-messenger-bot-api
#### NodeJS Facebook Messenger API
[![version](https://img.shields.io/npm/v/fb-messenger-bot-api.svg)](http://npm.im/fb-messenger-bot-api)
[![version](https://img.shields.io/npm/v/fb-messenger-bot-api.svg)](http://npm.im/fb-messenger-bot-api2)
[![travis build](https://img.shields.io/travis/crisboarna/fb-messenger-bot-api.svg)](https://travis-ci.org/crisboarna/fb-messenger-bot-api)

@@ -19,3 +19,3 @@ [![codecov coverage](https://img.shields.io/codecov/c/github/crisboarna/fb-messenger-bot-api.svg)](https://codecov.io/gh/crisboarna/fb-messenger-bot-api)

```
npm install fb-messenger-bot-api
npm install fb-messenger-bot-api2
```

@@ -53,3 +53,3 @@

## Documentation
You can find documentation [here](https://crisboarna.github.io/fb-messenger-bot-api/)
You can find documentation [here](https://github.com/theguest268/fb-messenger-bot-api)

@@ -72,7 +72,7 @@ ## Features

```javascript
const facebook = require('fb-messenger-bot-api');
const facebook = require('fb-messenger-bot-api2');
```
or
```typescript
import { FacebookMessagingAPIClient, etc... } from 'fb-messenger-bot-api';
import { FacebookMessagingAPIClient, etc... } from 'fb-messenger-bot-api2';
```

@@ -196,3 +196,3 @@

```typescript
import {FacebookMessageParser} from 'fb-messenger-bot-api';
import {FacebookMessageParser} from 'fb-messenger-bot-api2';
const messages = FacebookMessageParser.parsePayload(incomingPayload);

@@ -208,3 +208,3 @@ ```

```typescript
import {Profile} from 'fb-messenger-bot-api';
import {Profile} from 'fb-messenger-bot-api2';
const profileClient = new FacebookProfileAPIClient(process.env.PAGE_ACCESS_TOKEN);

@@ -255,3 +255,3 @@ ```

```typescript
import {FacebookPageAPIClient} from 'fb-messenger-bot-api';
import {FacebookPageAPIClient} from 'fb-messenger-bot-api2';
const pageClient = new FacebookPageAPIClient(process.env.PAGE_ID, process.env.PAGE_ACCESS_TOKEN)

@@ -292,3 +292,3 @@ ```

```javascript
const facebook = require('fb-messenger-bot-api');
const facebook = require('fb-messenger-bot-api2');
const router = require('express').Router();

@@ -319,3 +319,3 @@ router.get('/api/webhook',(req, res) => facebook.ValidateWebhook.validateServer(req,res));

```typescript
import {ValidateWebhook} from 'fb-messenger-bot-api';
import {ValidateWebhook} from 'fb-messenger-bot-api2';
const handler = (event, context, callback: Function) => {

@@ -339,3 +339,3 @@ ...

```typescript
import {ValidateWebhook} from 'fb-messenger-bot-api';
import {ValidateWebhook} from 'fb-messenger-bot-api2';
const messageIntegrityChecker = (req, res) => {

@@ -351,3 +351,3 @@ const validMessage = ValidateWebhook.validateMessageIntegrity(req.headers["x-hub-signature"]);

const router = require('express').Router();
const facebook = require('fb-messenger-bot-api');
const facebook = require('fb-messenger-bot-api2');
const messagingClient = new facebook.FacebookMessagingAPIClient(process.env.PAGE_ACCESS_TOKEN);

@@ -377,3 +377,3 @@ const messageParser = facebook.FacebookMessageParser;

```typescript
import {FacebookMessagingAPIClient, ValidateWebhook, FacebookMessageParser} from 'fb-messenger-bot-api';
import {FacebookMessagingAPIClient, ValidateWebhook, FacebookMessageParser} from 'fb-messenger-bot-api2';
import {Router} from 'express';

@@ -380,0 +380,0 @@ ...

Sorry, the diff of this file is not supported yet

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