Messaging APIs for multi-platform
onRequest
.sendAirlineFlightUpdateTemplate
MessengerBatch
getActiveThreads
and getReportedConversationsByReportType
v4
getThreadOwner
in MessengerBatch
createListTemplate
and createOpenGraphTemplate
createMessageCreative
, sendBroadcastMessage
, cancelBroadcast
, getBroadcast
, startReachEstimation
, getReachEstimate
, getBroadcastMessagesSent
and generateMessengerCode
.options
to messenger batch functions 047db83
options.fields
to getUserProfile
:client
.getUserProfile(USER_ID, {
fields: [
`id`,
`name`,
`first_name`,
`last_name`,
`profile_pic`,
`locale`,
`timezone`,
`gender`,
],
})
.then(user => {
console.log(user);
// {
// id: '5566'
// first_name: 'Johnathan',
// last_name: 'Jackson',
// profile_pic: 'https://example.com/pic.png',
// locale: 'en_US',
// timezone: 8,
// gender: 'male',
// }
});
client.getSubscriptions
:client.getSubscriptions({
access_token: APP_ACCESS_TOKEN,
});
// or
client.getSubscriptions({
access_token: `${APP_ID}|${APP_SECRET}`,
});
client.getPageSubscription
:client.getPageSubscription({
access_token: APP_ACCESS_TOKEN,
});
// or
client.getPageSubscription({
access_token: `${APP_ID}|${APP_SECRET}`,
});
client.debugToken
:client.debugToken().then(pageInfo => {
console.log(pageInfo);
// {
// app_id: '000000000000000',
// application: 'Social Cafe',
// expires_at: 1352419328,
// is_valid: true,
// issued_at: 1347235328,
// scopes: ['email', 'user_location'],
// user_id: 1207059,
// }
});
client.multicastFlex
:client.multicastFlex([USER_ID], 'this is a flex', {
type: 'bubble',
header: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'text',
text: 'Header text',
},
],
},
hero: {
type: 'image',
url: 'https://example.com/flex/images/image.jpg',
},
body: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'text',
text: 'Body text',
},
],
},
footer: {
type: 'box',
layout: 'vertical',
contents: [
{
type: 'text',
text: 'Footer text',
},
],
},
styles: {
comment: 'See the example of a bubble style object',
},
});
video
for imagemap:const res = await client.replyImagemap(REPLY_TOKEN, 'this is an imagemap', {
baseUrl: 'https://example.com/bot/images/rm001',
baseSize: {
height: 1040,
width: 1040,
},
video: {
originalContentUrl: 'https://example.com/video.mp4',
previewImageUrl: 'https://example.com/video_preview.jpg',
area: {
x: 0,
y: 0,
width: 1040,
height: 585,
},
externalLink: {
linkUri: 'https://example.com/see_more.html',
label: 'See More',
},
},
actions: [
{
type: 'uri',
linkUri: 'https://example.com/',
area: {
x: 0,
y: 0,
width: 520,
height: 1040,
},
},
{
type: 'message',
text: 'hello',
area: {
x: 520,
y: 0,
width: 520,
height: 1040,
},
},
],
});