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
3
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.6.13 to 0.6.14

2

lib/MessengerClient.js

@@ -1668,3 +1668,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;};

return this.sendAttachmentFormData(recipient, attachment, file, options);};this.sendTemplate = (recipient, payload, options) => this.sendAttachment(recipient, { type: 'template', payload }, options);this.sendButtonTemplate = (recipient, text, buttons, options) => this.sendTemplate(recipient, { template_type: 'button', text, buttons }, options);this.sendGenericTemplate = (recipient, elements, options = {}) => this.sendTemplate(recipient, { template_type: 'generic', elements, image_aspect_ratio: options.image_aspect_ratio || 'horizontal' }, (0, _lodash2.default)(options, ['image_aspect_ratio']));this.sendListTemplate = (recipient, elements, buttons, options = {}) => this.sendTemplate(recipient, { template_type: 'list', elements, buttons, top_element_style: options.top_element_style || 'large' }, (0, _lodash2.default)(options, ['top_element_style']));this.sendOpenGraphTemplate = (recipient, elements, options) => this.sendTemplate(recipient, { template_type: 'open_graph', elements }, options);this.sendReceiptTemplate = (recipient, attrs, options) => this.sendTemplate(recipient, _extends({ template_type: 'receipt' }, attrs), options);this.sendMediaTemplate = (recipient, elements, options) => this.sendTemplate(recipient, { template_type: 'media', elements }, options);this.sendAirlineBoardingPassTemplate = (recipient, attrs, options) => this.sendTemplate(recipient, _extends({ template_type: 'airline_boardingpass' }, attrs), options);this.sendAirlineCheckinTemplate = (recipient, attrs, options) => this.sendTemplate(recipient, _extends({ template_type: 'airline_checkin' }, attrs), options);this.sendAirlineItineraryTemplate = (recipient, attrs, options) => this.sendTemplate(recipient, _extends({ template_type: 'airline_itinerary' }, attrs), options);this.sendAirlineFlightUpdateTemplate = (recipient, attrs, options) => this.sendTemplate(recipient, _extends({ template_type: 'airline_update' }, attrs), options);this.sendQuickReplies = (recipient, textOrAttachment, quickReplies, options) => {(0, _warning2.default)(false, '`sendQuickReplies` is deprecated. Use send message methods with `options.quick_replies` instead.');validateQuickReplies(quickReplies);return this.sendMessage(recipient, _extends({}, textOrAttachment, { quick_replies: quickReplies }), options);};this.sendSenderAction = (idOrRecipient, action, { access_token: customAccessToken } = {}) => {const recipient = typeof idOrRecipient === 'string' ? { id: idOrRecipient } : idOrRecipient;return this.sendRawBody({ recipient, sender_action: action, access_token: customAccessToken });};this.markSeen = (recipient, options = {}) => this.sendSenderAction(recipient, 'mark_seen', options);this.typingOn = (recipient, options = {}) => this.sendSenderAction(recipient, 'typing_on', options);this.typingOff = (recipient, options = {}) => this.sendSenderAction(recipient, 'typing_off', options);this.sendBatch = (batch, { access_token: customAccessToken } = {}) => {(0, _invariant2.default)(batch.length <= 50, 'limit the number of requests which can be in a batch to 50');const bodyEncodedbatch = batch.map(item => {if (item.body) {return _extends({}, item, { body: Object.keys(item.body).map(key => {// $FlowFixMe item.body should not possible as undefined.
const val = item.body[key];return `${encodeURIComponent(key)}=${encodeURIComponent(typeof val === 'object' ? JSON.stringify(val) : val)}`;}).join('&') });}return item;});return _axios2.default.post('https://graph.facebook.com/', { access_token: customAccessToken || this._accessToken, batch: bodyEncodedbatch }).then(res => res.data);};this.createMessageCreative = (messages = [], { access_token: customAccessToken } = {}) => this._axios.post(`/me/message_creatives?access_token=${customAccessToken || this._accessToken}`, { messages }).then(res => res.data, handleError);this.sendBroadcastMessage = (messageCreativeId, options = {}) => this._axios.post(`/me/broadcast_messages?access_token=${options.access_token || this._accessToken}`, _extends({ message_creative_id: messageCreativeId }, options)).then(res => res.data, handleError);this.sendSponsoredMessage = (adAccountId, message) => this._axios.post(`/act_${adAccountId}/sponsored_message_ads?access_token=${this._accessToken}`, message).then(res => res.data, handleError);this.createLabel = (name, { access_token: customAccessToken } = {}) => this._axios.post(`/me/custom_labels?access_token=${customAccessToken || this._accessToken}`, { name }).then(res => res.data, handleError);this.associateLabel = (userId, labelId, { access_token: customAccessToken } = {}) => this._axios.post(`/${labelId}/label?access_token=${customAccessToken || this._accessToken}`, { user: userId }).then(res => res.data, handleError);this.dissociateLabel = (userId, labelId, { access_token: customAccessToken } = {}) => this._axios.delete(`/${labelId}/label?access_token=${customAccessToken || this._accessToken}`, { data: { user: userId } }).then(res => res.data, handleError);this.getAssociatedLabels = (userId, { access_token: customAccessToken } = {}) => this._axios.get(`/${userId}/custom_labels?access_token=${customAccessToken || this._accessToken}`).then(res => res.data, handleError);this.getLabelDetails = (labelId, options = {}) => {const fields = options.fields ? options.fields.join(',') : 'name';return this._axios.get(`/${labelId}?fields=${fields}&access_token=${options.access_token || this._accessToken}`).then(res => res.data, handleError);};this.getLabelList = (options = {}) => {const fields = options.fields ? options.fields.join(',') : 'name';return this._axios.get(`/me/custom_labels?fields=${fields}&access_token=${options.access_token || this._accessToken}`).then(res => res.data, handleError);};this.deleteLabel = (labelId, { access_token: customAccessToken } = {}) => this._axios.delete(`/${labelId}?access_token=${customAccessToken || this._accessToken}`).then(res => res.data, handleError);this.startReachEstimation = (customLabelId, { access_token: customAccessToken } = {}) => this._axios.post(`/broadcast_reach_estimations?access_token=${customAccessToken || this._accessToken}`, { custom_label_id: customLabelId }).then(res => res.data, handleError);this.getReachEstimate = (reachEstimationId, { access_token: customAccessToken } = {}) => this._axios.post(`/${reachEstimationId}?access_token=${customAccessToken || this._accessToken}`).then(res => res.data, handleError);this.getBroadcastMessagesSent = (broadcastId, { access_token: customAccessToken } = {}) => this._axios.post(`/${broadcastId}/insights/messages_sent?access_token=${customAccessToken || this._accessToken}`).then(res => res.data.data, handleError);this.uploadAttachment = (type, attachment, options = {}) => {const args = [];const isReusable = options.is_reusable || false;if (typeof attachment === 'string') {args.push({ message: { attachment: { type, payload: { url: attachment, is_reusable: isReusable } } } });} else {const form = new _formData2.default();form.append('message', JSON.stringify({ attachment: { type, payload: { is_reusable: isReusable } } }));form.append('filedata', attachment, (0, _lodash2.default)(options, ['is_reusable']));args.push(form, { headers: form.getHeaders() });}return this._axios.post(`/me/message_attachments?access_token=${options.access_token || this._accessToken}`, ...args).then(res => res.data, handleError);};this.uploadAudio = (attachment, options) => this.uploadAttachment('audio', attachment, options);this.uploadImage = (attachment, options) => this.uploadAttachment('image', attachment, options);this.uploadVideo = (attachment, options) => this.uploadAttachment('video', attachment, options);this.uploadFile = (attachment, options) => this.uploadAttachment('file', attachment, options);this.generateMessengerCode = (options = {}) => this._axios.post(`/me/messenger_codes?access_token=${options.access_token || this._accessToken}`, _extends({ type: 'standard' }, options)).then(res => res.data, handleError);this.passThreadControl = (recipientId, targetAppId, metadata, { access_token: customAccessToken } = {}) => this._axios.post(`/me/pass_thread_control?access_token=${customAccessToken || this._accessToken}`, { recipient: { id: recipientId }, target_app_id: targetAppId, metadata }).then(res => res.data, handleError);this.passThreadControlToPageInbox = (recipientId, metadata, options = {}) => this.passThreadControl(recipientId, 263902037430900, metadata, options);this.takeThreadControl = (recipientId, metadata, { access_token: customAccessToken } = {}) => this._axios.post(`/me/take_thread_control?access_token=${customAccessToken || this._accessToken}`, { recipient: { id: recipientId }, metadata }).then(res => res.data, handleError);this.getSecondaryReceivers = ({ access_token: customAccessToken } = {}) => this._axios.get(`/me/secondary_receivers?fields=id,name&access_token=${customAccessToken || this._accessToken}`).then(res => res.data.data, handleError);this.getInsights = (metrics, options = {}) => this._axios.get(`/me/insights/?${_querystring2.default.stringify(_extends({ metric: metrics.join(','), access_token: options.access_token || this._accessToken }, options))}`).then(res => res.data.data, handleError);this.getDailyUniqueActiveThreadCounts = (options = {}) => this.getInsights(['page_messages_active_threads_unique'], options);this.getBlockedConversations = (options = {}) => this.getInsights(['page_messages_blocked_conversations_unique'], options);this.getReportedConversations = (options = {}) => this.getInsights(['page_messages_reported_conversations_unique'], options);this.getReportedConversationsByReportType = (options = {}) => this.getInsights(['page_messages_blocked_conversations_unique'], options);this.getDailyUniqueConversationCounts = () => {(0, _warning2.default)(false, 'page_messages_feedback_by_action_unique is deprecated as of November 7, 2017.\nThis metric will be removed in Graph API v2.12.');return this.getInsights(['page_messages_feedback_by_action_unique']);};this.setNLPConfigs = (config = {}, { access_token: customAccessToken } = {}) => this._axios.post(`/me/nlp_configs?${_querystring2.default.stringify(config)}`, { access_token: customAccessToken || this._accessToken }).then(res => res.data, handleError);this.enableNLP = (options = {}) => this.setNLPConfigs({ nlp_enabled: true }, options);this.disableNLP = (options = {}) => this.setNLPConfigs({ nlp_enabled: false }, options);this.logCustomEvents = ({ app_id, appId, page_id, pageId, page_scoped_user_id, userId, events, access_token: customAccessToken }) => {// FIXME: remove in v0.7
const val = item.body[key];return `${encodeURIComponent(key)}=${encodeURIComponent(typeof val === 'object' ? JSON.stringify(val) : val)}`;}).join('&') });}return item;});return _axios2.default.post('https://graph.facebook.com/', { access_token: customAccessToken || this._accessToken, batch: bodyEncodedbatch }).then(res => res.data);};this.createMessageCreative = (messages = [], { access_token: customAccessToken } = {}) => this._axios.post(`/me/message_creatives?access_token=${customAccessToken || this._accessToken}`, { messages }).then(res => res.data, handleError);this.sendBroadcastMessage = (messageCreativeId, options = {}) => this._axios.post(`/me/broadcast_messages?access_token=${options.access_token || this._accessToken}`, _extends({ message_creative_id: messageCreativeId }, options)).then(res => res.data, handleError);this.sendSponsoredMessage = (adAccountId, message) => this._axios.post(`/act_${adAccountId}/sponsored_message_ads?access_token=${this._accessToken}`, message).then(res => res.data, handleError);this.createLabel = (name, { access_token: customAccessToken } = {}) => this._axios.post(`/me/custom_labels?access_token=${customAccessToken || this._accessToken}`, { name }).then(res => res.data, handleError);this.associateLabel = (userId, labelId, { access_token: customAccessToken } = {}) => this._axios.post(`/${labelId}/label?access_token=${customAccessToken || this._accessToken}`, { user: userId }).then(res => res.data, handleError);this.dissociateLabel = (userId, labelId, { access_token: customAccessToken } = {}) => this._axios.delete(`/${labelId}/label?access_token=${customAccessToken || this._accessToken}`, { data: { user: userId } }).then(res => res.data, handleError);this.getAssociatedLabels = (userId, { access_token: customAccessToken } = {}) => this._axios.get(`/${userId}/custom_labels?access_token=${customAccessToken || this._accessToken}`).then(res => res.data, handleError);this.getLabelDetails = (labelId, options = {}) => {const fields = options.fields ? options.fields.join(',') : 'name';return this._axios.get(`/${labelId}?fields=${fields}&access_token=${options.access_token || this._accessToken}`).then(res => res.data, handleError);};this.getLabelList = (options = {}) => {const fields = options.fields ? options.fields.join(',') : 'name';return this._axios.get(`/me/custom_labels?fields=${fields}&access_token=${options.access_token || this._accessToken}`).then(res => res.data, handleError);};this.deleteLabel = (labelId, { access_token: customAccessToken } = {}) => this._axios.delete(`/${labelId}?access_token=${customAccessToken || this._accessToken}`).then(res => res.data, handleError);this.startReachEstimation = (customLabelId, { access_token: customAccessToken } = {}) => this._axios.post(`/me/broadcast_reach_estimations?access_token=${customAccessToken || this._accessToken}`, { custom_label_id: customLabelId }).then(res => res.data, handleError);this.getReachEstimate = (reachEstimationId, { access_token: customAccessToken } = {}) => this._axios.get(`/${reachEstimationId}?access_token=${customAccessToken || this._accessToken}`).then(res => res.data, handleError);this.getBroadcastMessagesSent = (broadcastId, { access_token: customAccessToken } = {}) => this._axios.post(`/${broadcastId}/insights/messages_sent?access_token=${customAccessToken || this._accessToken}`).then(res => res.data.data, handleError);this.uploadAttachment = (type, attachment, options = {}) => {const args = [];const isReusable = options.is_reusable || false;if (typeof attachment === 'string') {args.push({ message: { attachment: { type, payload: { url: attachment, is_reusable: isReusable } } } });} else {const form = new _formData2.default();form.append('message', JSON.stringify({ attachment: { type, payload: { is_reusable: isReusable } } }));form.append('filedata', attachment, (0, _lodash2.default)(options, ['is_reusable']));args.push(form, { headers: form.getHeaders() });}return this._axios.post(`/me/message_attachments?access_token=${options.access_token || this._accessToken}`, ...args).then(res => res.data, handleError);};this.uploadAudio = (attachment, options) => this.uploadAttachment('audio', attachment, options);this.uploadImage = (attachment, options) => this.uploadAttachment('image', attachment, options);this.uploadVideo = (attachment, options) => this.uploadAttachment('video', attachment, options);this.uploadFile = (attachment, options) => this.uploadAttachment('file', attachment, options);this.generateMessengerCode = (options = {}) => this._axios.post(`/me/messenger_codes?access_token=${options.access_token || this._accessToken}`, _extends({ type: 'standard' }, options)).then(res => res.data, handleError);this.passThreadControl = (recipientId, targetAppId, metadata, { access_token: customAccessToken } = {}) => this._axios.post(`/me/pass_thread_control?access_token=${customAccessToken || this._accessToken}`, { recipient: { id: recipientId }, target_app_id: targetAppId, metadata }).then(res => res.data, handleError);this.passThreadControlToPageInbox = (recipientId, metadata, options = {}) => this.passThreadControl(recipientId, 263902037430900, metadata, options);this.takeThreadControl = (recipientId, metadata, { access_token: customAccessToken } = {}) => this._axios.post(`/me/take_thread_control?access_token=${customAccessToken || this._accessToken}`, { recipient: { id: recipientId }, metadata }).then(res => res.data, handleError);this.getSecondaryReceivers = ({ access_token: customAccessToken } = {}) => this._axios.get(`/me/secondary_receivers?fields=id,name&access_token=${customAccessToken || this._accessToken}`).then(res => res.data.data, handleError);this.getInsights = (metrics, options = {}) => this._axios.get(`/me/insights/?${_querystring2.default.stringify(_extends({ metric: metrics.join(','), access_token: options.access_token || this._accessToken }, options))}`).then(res => res.data.data, handleError);this.getDailyUniqueActiveThreadCounts = (options = {}) => this.getInsights(['page_messages_active_threads_unique'], options);this.getBlockedConversations = (options = {}) => this.getInsights(['page_messages_blocked_conversations_unique'], options);this.getReportedConversations = (options = {}) => this.getInsights(['page_messages_reported_conversations_unique'], options);this.getReportedConversationsByReportType = (options = {}) => this.getInsights(['page_messages_blocked_conversations_unique'], options);this.getDailyUniqueConversationCounts = () => {(0, _warning2.default)(false, 'page_messages_feedback_by_action_unique is deprecated as of November 7, 2017.\nThis metric will be removed in Graph API v2.12.');return this.getInsights(['page_messages_feedback_by_action_unique']);};this.setNLPConfigs = (config = {}, { access_token: customAccessToken } = {}) => this._axios.post(`/me/nlp_configs?${_querystring2.default.stringify(config)}`, { access_token: customAccessToken || this._accessToken }).then(res => res.data, handleError);this.enableNLP = (options = {}) => this.setNLPConfigs({ nlp_enabled: true }, options);this.disableNLP = (options = {}) => this.setNLPConfigs({ nlp_enabled: false }, options);this.logCustomEvents = ({ app_id, appId, page_id, pageId, page_scoped_user_id, userId, events, access_token: customAccessToken }) => {// FIXME: remove in v0.7
(0, _warning2.default)(!appId, '`appId` is deprecated. Use `app_id` instead.');(0, _warning2.default)(!pageId, '`pageId` is deprecated. Use `page_id` instead.');(0, _warning2.default)(!userId, '`userId` is deprecated. Use `page_scoped_user_id` instead.'); /* eslint-disable no-param-reassign */app_id = app_id || appId;page_id = page_id || pageId;page_scoped_user_id = page_scoped_user_id || userId; /* eslint-enable no-param-reassign */return this._axios.post(`/${app_id}/activities?access_token=${customAccessToken || this._accessToken}`, { event: 'CUSTOM_APP_EVENTS', custom_events: JSON.stringify(events), advertiser_tracking_enabled: 0, application_tracking_enabled: 0, extinfo: JSON.stringify(['mb1']), page_id, page_scoped_user_id }).then(res => res.data, handleError);};this.getUserField = ({ field, user_id, app_secret, app, page, access_token: customAccessToken }) => {const accessToken = customAccessToken || this._accessToken; // $appsecret_proof= hash_hmac('sha256', $access_token, $app_secret);

@@ -1671,0 +1671,0 @@ const appsecretProof = _crypto2.default.createHmac('sha256', app_secret).update(accessToken).digest('hex');const appQueryString = app ? `&app=${app}` : '';const pageQueryString = page ? `&page=${page}` : '';return this._axios.get(`/${user_id}/${field}?access_token=${accessToken}&appsecret_proof=${appsecretProof}${appQueryString}${pageQueryString}`).then(res => res.data, handleError);};this.getIdsForApps = ({ user_id, app_secret, app, page, access_token }) => this.getUserField({ field: 'ids_for_apps', user_id, app_secret, app, page, access_token });this.getIdsForPages = ({ user_id, app_secret, app, page, access_token }) =>

{
"name": "messaging-api-messenger",
"description": "Messaging API client for Messenger",
"version": "0.6.13",
"version": "0.6.14",
"engines": {

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

@@ -1287,3 +1287,3 @@ /* @flow */

.post(
`/broadcast_reach_estimations?access_token=${customAccessToken ||
`/me/broadcast_reach_estimations?access_token=${customAccessToken ||
this._accessToken}`,

@@ -1306,3 +1306,3 @@ {

this._axios
.post(
.get(
`/${reachEstimationId}?access_token=${customAccessToken ||

@@ -1309,0 +1309,0 @@ this._accessToken}`

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