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

messaging-api-messenger

Package Overview
Dependencies
Maintainers
2
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

messaging-api-messenger - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

13

lib/MessengerClient.js

@@ -38,2 +38,3 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _extends = Object.assign || function (target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i];for (var key in source) {if (Object.prototype.hasOwnProperty.call(source, key)) {target[key] = source[key];}}}return target;};var _axios = require('axios');var _axios2 = _interopRequireDefault(_axios);

class MessengerClient {

@@ -471,2 +472,12 @@

// https://developers.facebook.com/docs/messenger-platform/open-graph-template
// https://developers.facebook.com/docs/messenger-platform/send-api-reference/receipt-template

@@ -596,3 +607,3 @@

payload: { url } });this.sendImage = (recipientId, url) => this.sendAttachment(recipientId, { type: 'image', payload: { url } });this.sendVideo = (recipientId, url) => this.sendAttachment(recipientId, { type: 'video', payload: { url } });this.sendFile = (recipientId, url) => this.sendAttachment(recipientId, { type: 'file', payload: { url } });this.sendTemplate = (recipientId, payload, options) => this.sendAttachment(recipientId, { type: 'template', payload }, options);this.sendButtonTemplate = (recipientId, text, buttons) => this.sendTemplate(recipientId, { template_type: 'button', text, buttons });this.sendGenericTemplate = (recipientId, elements, ratio = 'horizontal', options) => this.sendTemplate(recipientId, { template_type: 'generic', elements, image_aspect_ratio: ratio // FIXME rename to image_aspect_ratio?
}, options);this.sendShippingUpdateTemplate = (recipientId, elements, ratio = 'horizontal') => this.sendGenericTemplate(recipientId, elements, ratio, { tag: 'SHIPPING_UPDATE' });this.sendReservationUpdateTemplate = (recipientId, elements, ratio = 'horizontal') => this.sendGenericTemplate(recipientId, elements, ratio, { tag: 'RESERVATION_UPDATE' });this.sendIssueResolutionTemplate = (recipientId, elements, ratio = 'horizontal') => this.sendGenericTemplate(recipientId, elements, ratio, { tag: 'ISSUE_RESOLUTION' });this.sendListTemplate = (recipientId, elements, buttons, topElementStyle = 'large') => this.sendTemplate(recipientId, { template_type: 'list', elements, buttons, top_element_style: topElementStyle });this.sendReceiptTemplate = (recipientId, attrs) => this.sendTemplate(recipientId, _extends({ template_type: 'receipt' }, attrs));this.sendAirlineBoardingPassTemplate = (recipientId, attrs) => this.sendTemplate(recipientId, _extends({ template_type: 'airline_boardingpass' }, attrs));this.sendAirlineCheckinTemplate = (recipientId, attrs) => this.sendTemplate(recipientId, _extends({ template_type: 'airline_checkin' }, attrs));this.sendAirlineItineraryTemplate = (recipientId, attrs) => this.sendTemplate(recipientId, _extends({ template_type: 'airline_itinerary' }, attrs));this.sendAirlineFlightUpdateTemplate = (recipientId, attrs) => this.sendTemplate(recipientId, _extends({ template_type: 'airline_update' }, attrs));this.sendQuickReplies = (recipientId, textOrAttachment, quickReplies) => {// quick_replies is limited to 11
}, options);this.sendShippingUpdateTemplate = (recipientId, elements, ratio = 'horizontal') => this.sendGenericTemplate(recipientId, elements, ratio, { tag: 'SHIPPING_UPDATE' });this.sendReservationUpdateTemplate = (recipientId, elements, ratio = 'horizontal') => this.sendGenericTemplate(recipientId, elements, ratio, { tag: 'RESERVATION_UPDATE' });this.sendIssueResolutionTemplate = (recipientId, elements, ratio = 'horizontal') => this.sendGenericTemplate(recipientId, elements, ratio, { tag: 'ISSUE_RESOLUTION' });this.sendListTemplate = (recipientId, elements, buttons, topElementStyle = 'large') => this.sendTemplate(recipientId, { template_type: 'list', elements, buttons, top_element_style: topElementStyle });this.sendOpenGraphTemplate = (recipientId, elements) => this.sendTemplate(recipientId, { template_type: 'open_graph', elements });this.sendReceiptTemplate = (recipientId, attrs) => this.sendTemplate(recipientId, _extends({ template_type: 'receipt' }, attrs));this.sendAirlineBoardingPassTemplate = (recipientId, attrs) => this.sendTemplate(recipientId, _extends({ template_type: 'airline_boardingpass' }, attrs));this.sendAirlineCheckinTemplate = (recipientId, attrs) => this.sendTemplate(recipientId, _extends({ template_type: 'airline_checkin' }, attrs));this.sendAirlineItineraryTemplate = (recipientId, attrs) => this.sendTemplate(recipientId, _extends({ template_type: 'airline_itinerary' }, attrs));this.sendAirlineFlightUpdateTemplate = (recipientId, attrs) => this.sendTemplate(recipientId, _extends({ template_type: 'airline_update' }, attrs));this.sendQuickReplies = (recipientId, textOrAttachment, quickReplies) => {// quick_replies is limited to 11
(0, _invariant2.default)(Array.isArray(quickReplies) && quickReplies.length <= 11, 'quickReplies is an array and limited to 11');quickReplies.forEach(quickReply => {if (quickReply.content_type === 'text') {// title has a 20 character limit, after that it gets truncated

@@ -599,0 +610,0 @@ (0, _invariant2.default)(quickReply.title.trim().length <= 20, 'title of quickReply has a 20 character limit, after that it gets truncated'); // payload has a 1000 character limit

2

package.json
{
"name": "messaging-api-messenger",
"description": "Messaging API client for Messenger",
"version": "0.2.1",
"version": "0.2.2",
"engines": {

@@ -6,0 +6,0 @@ "node": ">=6"

@@ -17,2 +17,3 @@ import axios from 'axios';

User,
OpenGraphElement,
ReceiptAttributes,

@@ -471,2 +472,12 @@ AirlineBoardingPassAttributes,

// https://developers.facebook.com/docs/messenger-platform/open-graph-template
sendOpenGraphTemplate = (
recipientId: string,
elements: Array<OpenGraphElement>
): Promise<SendMessageSucessResponse> =>
this.sendTemplate(recipientId, {
template_type: 'open_graph',
elements,
});
// https://developers.facebook.com/docs/messenger-platform/send-api-reference/receipt-template

@@ -473,0 +484,0 @@ sendReceiptTemplate = (

@@ -55,2 +55,7 @@ /* @flow */

export type OpenGraphElement = {
url: string,
buttons?: Array<TemplateButton>,
};
export type Address = {

@@ -57,0 +62,0 @@ street_1: string,

Sorry, the diff of this file is too big to display

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