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 1.0.0-beta.16 to 1.0.0-beta.18

142

dist/MessengerClient.d.ts

@@ -221,21 +221,27 @@ import FormData from 'form-data';

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#create_label
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#create_label
*/
createLabel(name: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<any>;
createLabel(name: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<{
id: string;
}>;
/**
* Associating a Label to a PSID
*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#associate_label
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#associate_label
*/
associateLabel(userId: string, labelId: number, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<any>;
associateLabel(userId: string, labelId: number, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<{
success: true;
}>;
/**
* Removing a Label From a PSID
*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#associate_label
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#remove_label
*/
dissociateLabel(userId: string, labelId: number, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<any>;
dissociateLabel(userId: string, labelId: number, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<{
success: true;
}>;
/**
* Retrieving Labels Associated with a PSID
*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#get_all_labels
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#retrieving_labels_by_psid
*/

@@ -245,7 +251,18 @@ getAssociatedLabels(userId: string, options?: {

fields?: string[];
}): Promise<any>;
}): Promise<{
data: {
name: string;
id: string;
}[];
paging: {
cursors: {
before: string;
after: string;
};
};
}>;
/**
* Retrieving Label Details
*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#get_label_details
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#get_label_details
*/

@@ -255,7 +272,10 @@ getLabelDetails(labelId: number, options?: {

fields?: string[];
}): Promise<any>;
}): Promise<{
name: string;
id: string;
}>;
/**
* Retrieving a List of All Labels
*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#get_all_labels
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#get_all_labels
*/

@@ -265,9 +285,22 @@ getLabelList(options?: {

fields?: string[];
}): Promise<any>;
}): Promise<{
data: {
name: string;
id: string;
}[];
paging: {
cursors: {
before: string;
after: string;
};
};
}>;
/**
* Deleting a Label
*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#delete_label
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#delete_label
*/
deleteLabel(labelId: number, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<any>;
deleteLabel(labelId: number, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<{
success: true;
}>;
/**

@@ -293,4 +326,8 @@ * Upload API

*/
passThreadControl(recipientId: string, targetAppId: number, metadata?: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<any>;
passThreadControlToPageInbox(recipientId: string, metadata?: string, options?: Record<string, any>): Promise<any>;
passThreadControl(recipientId: string, targetAppId: number, metadata?: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<{
success: true;
}>;
passThreadControlToPageInbox(recipientId: string, metadata?: string, options?: Record<string, any>): Promise<{
success: true;
}>;
/**

@@ -301,3 +338,5 @@ * Take Thread Control

*/
takeThreadControl(recipientId: string, metadata?: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<any>;
takeThreadControl(recipientId: string, metadata?: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<{
success: true;
}>;
/**

@@ -308,3 +347,5 @@ * Request Thread Control

*/
requestThreadControl(recipientId: string, metadata?: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<any>;
requestThreadControl(recipientId: string, metadata?: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<{
success: true;
}>;
/**

@@ -315,3 +356,6 @@ * Secondary Receivers List

*/
getSecondaryReceivers({ accessToken: customAccessToken, }?: Types.AccessTokenOptions): Promise<any>;
getSecondaryReceivers({ accessToken: customAccessToken, }?: Types.AccessTokenOptions): Promise<{
id: string;
name: string;
}[]>;
/**

@@ -322,3 +366,5 @@ * Getting the Thread Owner

*/
getThreadOwner(recipientId: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<any>;
getThreadOwner(recipientId: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<{
appId: string;
}>;
/**

@@ -330,6 +376,34 @@ * Page Messaging Insights API

getInsights(metrics: Types.InsightMetric[], options?: Types.InsightOptions): Promise<any>;
getBlockedConversations(options?: Record<string, any>): Promise<any>;
getReportedConversations(options?: Record<string, any>): Promise<any>;
getTotalMessagingConnections(options?: Record<string, any>): Promise<any>;
getNewConversations(options?: Record<string, any>): Promise<any>;
getBlockedConversations(options: Types.InsightOptions): Promise<{
name: 'page_messages_blocked_conversations_unique';
period: 'day';
values: {
value: number | object;
endTime: string;
}[];
}>;
getReportedConversations(options: Types.InsightOptions): Promise<{
name: 'page_messages_reported_conversations_unique';
period: 'day';
values: {
value: number | object;
endTime: string;
}[];
}>;
getTotalMessagingConnections(options: Types.InsightOptions): Promise<{
name: 'page_messages_total_messaging_connections';
period: 'day';
values: {
value: number | object;
endTime: string;
}[];
}>;
getNewConversations(options: Types.InsightOptions): Promise<{
name: 'page_messages_new_conversations_unique';
period: 'day';
values: {
value: number | object;
endTime: string;
}[];
}>;
/**

@@ -395,3 +469,5 @@ * Built-in NLP API

*/
createPersona(persona: Types.Persona, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<any>;
createPersona(persona: Types.Persona, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<{
id: string;
}>;
/**

@@ -402,3 +478,7 @@ * Retrieving a Persona

*/
getPersona(personaId: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<any>;
getPersona(personaId: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<{
id: string;
name: string;
profilePictureUrl: string;
}>;
/**

@@ -422,3 +502,7 @@ * Retrieving All Available Personas

}>;
getAllPersonas({ accessToken: customAccessToken, }?: Types.AccessTokenOptions): Promise<Record<string, any>[]>;
getAllPersonas({ accessToken: customAccessToken, }?: Types.AccessTokenOptions): Promise<{
id: string;
name: string;
profilePictureUrl: string;
}[]>;
/**

@@ -429,4 +513,6 @@ * Deleting a Persona

*/
deletePersona(personaId: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<any>;
deletePersona(personaId: string, { accessToken: customAccessToken }?: Types.AccessTokenOptions): Promise<{
success: true;
}>;
}
//# sourceMappingURL=MessengerClient.d.ts.map

53

dist/MessengerClient.js

@@ -38,3 +38,2 @@ "use strict";

const omit_1 = __importDefault(require("lodash/omit"));
const warning_1 = __importDefault(require("warning"));
const messaging_api_common_1 = require("messaging-api-common");

@@ -626,5 +625,4 @@ const Messenger_1 = __importDefault(require("./Messenger"));

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#create_label
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#create_label
*/
// FIXME: [type] return type
createLabel(name, { accessToken: customAccessToken } = {}) {

@@ -641,5 +639,4 @@ return this._axios

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#associate_label
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#associate_label
*/
// FIXME: [type] return type
associateLabel(userId, labelId, { accessToken: customAccessToken } = {}) {

@@ -656,5 +653,4 @@ return this._axios

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#associate_label
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#remove_label
*/
// FIXME: [type] return type
dissociateLabel(userId, labelId, { accessToken: customAccessToken } = {}) {

@@ -671,5 +667,4 @@ return this._axios

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#get_all_labels
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#retrieving_labels_by_psid
*/
// FIXME: [type] return type
getAssociatedLabels(userId, options = {}) {

@@ -685,5 +680,4 @@ const fields = options.fields ? options.fields.join(',') : 'name';

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#get_label_details
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#get_label_details
*/
// FIXME: [type] return type
getLabelDetails(labelId, options = {}) {

@@ -699,5 +693,4 @@ const fields = options.fields ? options.fields.join(',') : 'name';

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#get_all_labels
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#get_all_labels
*/
// FIXME: [type] return type
getLabelList(options = {}) {

@@ -713,5 +706,4 @@ const fields = options.fields ? options.fields.join(',') : 'name';

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#delete_label
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#delete_label
*/
// FIXME: [type] return type
deleteLabel(labelId, { accessToken: customAccessToken } = {}) {

@@ -765,15 +757,15 @@ return this._axios

}
// FIXME: [type] return type
// FIXME: use TypeScript overloading
uploadAudio(attachment, options) {
return this.uploadAttachment('audio', attachment, options);
}
// FIXME: [type] return type
// FIXME: use TypeScript overloading
uploadImage(attachment, options) {
return this.uploadAttachment('image', attachment, options);
}
// FIXME: [type] return type
// FIXME: use TypeScript overloading
uploadVideo(attachment, options) {
return this.uploadAttachment('video', attachment, options);
}
// FIXME: [type] return type
// FIXME: use TypeScript overloading
uploadFile(attachment, options) {

@@ -792,3 +784,2 @@ return this.uploadAttachment('file', attachment, options);

*/
// FIXME: [type] return type
passThreadControl(recipientId, targetAppId, metadata, { accessToken: customAccessToken } = {}) {

@@ -804,3 +795,2 @@ return this._axios

}
// FIXME: [type] return type
passThreadControlToPageInbox(recipientId, metadata, options = {}) {

@@ -814,3 +804,2 @@ return this.passThreadControl(recipientId, 263902037430900, metadata, options);

*/
// FIXME: [type] return type
takeThreadControl(recipientId, metadata, { accessToken: customAccessToken } = {}) {

@@ -830,3 +819,2 @@ return this._axios

*/
// FIXME: [type] return type
requestThreadControl(recipientId, metadata, { accessToken: customAccessToken } = {}) {

@@ -846,3 +834,2 @@ return this._axios

*/
// FIXME: [type] return type
getSecondaryReceivers({ accessToken: customAccessToken, } = {}) {

@@ -859,5 +846,3 @@ return this._axios

*/
// FIXME: [type] return type
getThreadOwner(recipientId, { accessToken: customAccessToken } = {}) {
warning_1.default(false, '`getThreadOwner` is currently in open beta, and is subject to change. See details in https://developers.facebook.com/docs/messenger-platform/handover-protocol/get-thread-owner');
return this._axios

@@ -879,8 +864,6 @@ .get(`/me/thread_owner?recipient=${recipientId}&access_token=${customAccessToken ||

}
// FIXME: [type] return type
getBlockedConversations(options = {}) {
getBlockedConversations(options) {
return this.getInsights(['page_messages_blocked_conversations_unique'], options).then(result => result[0]);
}
// FIXME: [type] return type
getReportedConversations(options = {}) {
getReportedConversations(options) {
return this.getInsights(['page_messages_reported_conversations_unique'], options).then(result => result[0]);

@@ -890,8 +873,6 @@ }

// This metrics replaces the page_messages_open_conversations_unique metric, which was deprecated on May 11, 2018.
// FIXME: [type] return type
getTotalMessagingConnections(options = {}) {
getTotalMessagingConnections(options) {
return this.getInsights(['page_messages_total_messaging_connections'], options).then(result => result[0]);
}
// FIXME: [type] return type
getNewConversations(options = {}) {
getNewConversations(options) {
return this.getInsights(['page_messages_new_conversations_unique'], options).then(result => result[0]);

@@ -994,3 +975,2 @@ }

*/
// FIXME: [type] return type
createPersona(persona, { accessToken: customAccessToken } = {}) {

@@ -1006,3 +986,2 @@ return this._axios

*/
// FIXME: [type] return type
getPersona(personaId, { accessToken: customAccessToken } = {}) {

@@ -1018,3 +997,2 @@ return this._axios

*/
// FIXME: [type] return type
getPersonas(cursor, { accessToken: customAccessToken } = {}) {

@@ -1045,3 +1023,2 @@ return this._axios

*/
// FIXME: [type] return type
deletePersona(personaId, { accessToken: customAccessToken } = {}) {

@@ -1048,0 +1025,0 @@ return this._axios

@@ -9,3 +9,3 @@ {

},
"version": "1.0.0-beta.16",
"version": "1.0.0-beta.18",
"main": "dist/index.js",

@@ -33,3 +33,3 @@ "browser": "lib/browser.js",

},
"gitHead": "e0695dde8d2b01d1a068f4086fbd7988bcf9de4c"
"gitHead": "7d803786ccc34105e4cf105c5d25b3354e1cb283"
}

@@ -14,3 +14,2 @@ import crypto from 'crypto';

import omit from 'lodash/omit';
import warning from 'warning';
import {

@@ -33,3 +32,3 @@ OnRequestFunction,

function handleError(err: AxiosError): void {
function handleError(err: AxiosError): never {
if (err.response && err.response.data) {

@@ -1122,11 +1121,10 @@ const error = get(err, 'response.data.error', {});

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#create_label
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#create_label
*/
// FIXME: [type] return type
createLabel(
name: string,
{ accessToken: customAccessToken }: Types.AccessTokenOptions = {}
) {
): Promise<{ id: string }> {
return this._axios
.post(
.post<{ id: string }>(
`/me/custom_labels?access_token=${customAccessToken ||

@@ -1144,5 +1142,4 @@ this._accessToken}`,

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#associate_label
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#associate_label
*/
// FIXME: [type] return type
associateLabel(

@@ -1152,5 +1149,5 @@ userId: string,

{ accessToken: customAccessToken }: Types.AccessTokenOptions = {}
) {
): Promise<{ success: true }> {
return this._axios
.post(
.post<{ success: true }>(
`/${labelId}/label?access_token=${customAccessToken ||

@@ -1168,5 +1165,4 @@ this._accessToken}`,

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#associate_label
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#remove_label
*/
// FIXME: [type] return type
dissociateLabel(

@@ -1176,5 +1172,5 @@ userId: string,

{ accessToken: customAccessToken }: Types.AccessTokenOptions = {}
) {
): Promise<{ success: true }> {
return this._axios
.delete(
.delete<{ success: true }>(
`/${labelId}/label?access_token=${customAccessToken ||

@@ -1192,12 +1188,27 @@ this._accessToken}`,

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#get_all_labels
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#retrieving_labels_by_psid
*/
// FIXME: [type] return type
getAssociatedLabels(
userId: string,
options: { accessToken?: string; fields?: string[] } = {}
) {
): Promise<{
data: { name: string; id: string }[];
paging: {
cursors: {
before: string;
after: string;
};
};
}> {
const fields = options.fields ? options.fields.join(',') : 'name';
return this._axios
.get(
.get<{
data: { name: string; id: string }[];
paging: {
cursors: {
before: string;
after: string;
};
};
}>(
`/${userId}/custom_labels?fields=${fields}&access_token=${options.accessToken ||

@@ -1212,12 +1223,11 @@ this._accessToken}`

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#get_label_details
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#get_label_details
*/
// FIXME: [type] return type
getLabelDetails(
labelId: number,
options: { accessToken?: string; fields?: string[] } = {}
) {
): Promise<{ name: string; id: string }> {
const fields = options.fields ? options.fields.join(',') : 'name';
return this._axios
.get(
.get<{ name: string; id: string }>(
`/${labelId}?fields=${fields}&access_token=${options.accessToken ||

@@ -1232,9 +1242,26 @@ this._accessToken}`

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#get_all_labels
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#get_all_labels
*/
// FIXME: [type] return type
getLabelList(options: { accessToken?: string; fields?: string[] } = {}) {
getLabelList(
options: { accessToken?: string; fields?: string[] } = {}
): Promise<{
data: { name: string; id: string }[];
paging: {
cursors: {
before: string;
after: string;
};
};
}> {
const fields = options.fields ? options.fields.join(',') : 'name';
return this._axios
.get(
.get<{
data: { name: string; id: string }[];
paging: {
cursors: {
before: string;
after: string;
};
};
}>(
`/me/custom_labels?fields=${fields}&access_token=${options.accessToken ||

@@ -1249,11 +1276,10 @@ this._accessToken}`

*
* https://developers.facebook.com/docs/messenger-platform/send-messages/broadcast-messages/target-broadcasts#delete_label
* https://developers.facebook.com/docs/messenger-platform/identity/custom-labels#delete_label
*/
// FIXME: [type] return type
deleteLabel(
labelId: number,
{ accessToken: customAccessToken }: Types.AccessTokenOptions = {}
) {
): Promise<{ success: true }> {
return this._axios
.delete(
.delete<{ success: true }>(
`/${labelId}?access_token=${customAccessToken || this._accessToken}`

@@ -1323,3 +1349,3 @@ )

// FIXME: [type] return type
// FIXME: use TypeScript overloading
uploadAudio(

@@ -1332,3 +1358,3 @@ attachment: string | Types.FileData,

// FIXME: [type] return type
// FIXME: use TypeScript overloading
uploadImage(

@@ -1341,3 +1367,3 @@ attachment: string | Types.FileData,

// FIXME: [type] return type
// FIXME: use TypeScript overloading
uploadVideo(

@@ -1350,3 +1376,3 @@ attachment: string | Types.FileData,

// FIXME: [type] return type
// FIXME: use TypeScript overloading
uploadFile(

@@ -1370,3 +1396,2 @@ attachment: string | Types.FileData,

*/
// FIXME: [type] return type
passThreadControl(

@@ -1377,5 +1402,5 @@ recipientId: string,

{ accessToken: customAccessToken }: Types.AccessTokenOptions = {}
) {
): Promise<{ success: true }> {
return this._axios
.post(
.post<{ success: true }>(
`/me/pass_thread_control?access_token=${customAccessToken ||

@@ -1392,3 +1417,2 @@ this._accessToken}`,

// FIXME: [type] return type
passThreadControlToPageInbox(

@@ -1398,3 +1422,3 @@ recipientId: string,

options: Record<string, any> = {}
) {
): Promise<{ success: true }> {
return this.passThreadControl(

@@ -1413,3 +1437,2 @@ recipientId,

*/
// FIXME: [type] return type
takeThreadControl(

@@ -1419,5 +1442,5 @@ recipientId: string,

{ accessToken: customAccessToken }: Types.AccessTokenOptions = {}
) {
): Promise<{ success: true }> {
return this._axios
.post(
.post<{ success: true }>(
`/me/take_thread_control?access_token=${customAccessToken ||

@@ -1438,3 +1461,2 @@ this._accessToken}`,

*/
// FIXME: [type] return type
requestThreadControl(

@@ -1444,5 +1466,5 @@ recipientId: string,

{ accessToken: customAccessToken }: Types.AccessTokenOptions = {}
) {
): Promise<{ success: true }> {
return this._axios
.post(
.post<{ success: true }>(
`/me/request_thread_control?access_token=${customAccessToken ||

@@ -1463,8 +1485,17 @@ this._accessToken}`,

*/
// FIXME: [type] return type
getSecondaryReceivers({
accessToken: customAccessToken,
}: Types.AccessTokenOptions = {}) {
}: Types.AccessTokenOptions = {}): Promise<
{
id: string;
name: string;
}[]
> {
return this._axios
.get(
.get<{
data: {
id: string;
name: string;
}[];
}>(
`/me/secondary_receivers?fields=id,name&access_token=${customAccessToken ||

@@ -1481,14 +1512,18 @@ this._accessToken}`

*/
// FIXME: [type] return type
getThreadOwner(
recipientId: string,
{ accessToken: customAccessToken }: Types.AccessTokenOptions = {}
) {
warning(
false,
'`getThreadOwner` is currently in open beta, and is subject to change. See details in https://developers.facebook.com/docs/messenger-platform/handover-protocol/get-thread-owner'
);
): Promise<{
appId: string;
}> {
return this._axios
.get(
.get<{
data: [
{
threadOwner: {
appId: string;
};
}
];
}>(
`/me/thread_owner?recipient=${recipientId}&access_token=${customAccessToken ||

@@ -1521,4 +1556,12 @@ this._accessToken}`

// FIXME: [type] return type
getBlockedConversations(options: Record<string, any> = {}) {
getBlockedConversations(
options: Types.InsightOptions
): Promise<{
name: 'page_messages_blocked_conversations_unique';
period: 'day';
values: {
value: number | object;
endTime: string;
}[];
}> {
return this.getInsights(

@@ -1530,4 +1573,12 @@ ['page_messages_blocked_conversations_unique'],

// FIXME: [type] return type
getReportedConversations(options: Record<string, any> = {}) {
getReportedConversations(
options: Types.InsightOptions
): Promise<{
name: 'page_messages_reported_conversations_unique';
period: 'day';
values: {
value: number | object;
endTime: string;
}[];
}> {
return this.getInsights(

@@ -1541,4 +1592,12 @@ ['page_messages_reported_conversations_unique'],

// This metrics replaces the page_messages_open_conversations_unique metric, which was deprecated on May 11, 2018.
// FIXME: [type] return type
getTotalMessagingConnections(options: Record<string, any> = {}) {
getTotalMessagingConnections(
options: Types.InsightOptions
): Promise<{
name: 'page_messages_total_messaging_connections';
period: 'day';
values: {
value: number | object;
endTime: string;
}[];
}> {
return this.getInsights(

@@ -1550,4 +1609,12 @@ ['page_messages_total_messaging_connections'],

// FIXME: [type] return type
getNewConversations(options: Record<string, any> = {}) {
getNewConversations(
options: Types.InsightOptions
): Promise<{
name: 'page_messages_new_conversations_unique';
period: 'day';
values: {
value: number | object;
endTime: string;
}[];
}> {
return this.getInsights(

@@ -1723,9 +1790,8 @@ ['page_messages_new_conversations_unique'],

*/
// FIXME: [type] return type
createPersona(
persona: Types.Persona,
{ accessToken: customAccessToken }: Types.AccessTokenOptions = {}
) {
): Promise<{ id: string }> {
return this._axios
.post(
.post<{ id: string }>(
`/me/personas?access_token=${customAccessToken || this._accessToken}`,

@@ -1742,11 +1808,16 @@ persona

*/
// FIXME: [type] return type
getPersona(
personaId: string,
{ accessToken: customAccessToken }: Types.AccessTokenOptions = {}
) {
): Promise<{
id: string;
name: string;
profilePictureUrl: string;
}> {
return this._axios
.get(
`/${personaId}?access_token=${customAccessToken || this._accessToken}`
)
.get<{
id: string;
name: string;
profilePictureUrl: string;
}>(`/${personaId}?access_token=${customAccessToken || this._accessToken}`)
.then(res => res.data, handleError);

@@ -1760,3 +1831,2 @@ }

*/
// FIXME: [type] return type
getPersonas(

@@ -1774,3 +1844,10 @@ cursor?: string,

return this._axios
.get(
.get<{
data: {
id: string;
name: string;
profilePictureUrl: string;
}[];
paging: { cursors: { before: string; after: string } };
}>(
`/me/personas?access_token=${customAccessToken || this._accessToken}${

@@ -1785,4 +1862,14 @@ cursor ? `&after=${cursor}` : ''

accessToken: customAccessToken,
}: Types.AccessTokenOptions = {}): Promise<Record<string, any>[]> {
let allPersonas: Record<string, any>[] = [];
}: Types.AccessTokenOptions = {}): Promise<
{
id: string;
name: string;
profilePictureUrl: string;
}[]
> {
let allPersonas: {
id: string;
name: string;
profilePictureUrl: string;
}[] = [];
let cursor;

@@ -1819,9 +1906,8 @@

*/
// FIXME: [type] return type
deletePersona(
personaId: string,
{ accessToken: customAccessToken }: Types.AccessTokenOptions = {}
) {
): Promise<{ success: true }> {
return this._axios
.delete(
.delete<{ success: true }>(
`/${personaId}?access_token=${customAccessToken || this._accessToken}`

@@ -1828,0 +1914,0 @@ )

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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