Releases: bottenderjs/messaging-apis
0.5.16 / 2017-12-05
- [new] Add
client.accessToken
getter
0.5.15 / 2017-12-04
messaging-api-slack
- [new] Support pass message object to
postMessage
:
client.postMessage('C8763', { text: 'Hello!' });
client.postMessage('C8763', { attachments: [someAttachments] });
client.postMessage('C8763', { text: 'Hello!' }, { as_user: true });
0.5.14 / 2017-11-29
messaging-api-messenger
- [new] Support call api methods with custom
access_token
(Experimental)
0.5.13 / 2017-11-28
messaging-api-messenger
- [fix] Fixed
uploadAttachment
with buffer data using afilename
option pass in:
client.uploadAttachment('image', buffer, { filename: 'image.jpg' });
Thanks for @JonathanZWhite!
0.5.12 / 2017-11-23
messaging-api-messenger
- [new] Support pass
options.quick_replies
to send message with quick replies: #216
client.sendText(USER_ID, 'Pick a color:', {
quick_replies: [
{
content_type: 'text',
title: 'Red',
payload: 'DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_RED',
},
],
});
- [new] Support upload attachment from buffer or stream #219
For example:
client.uploadImage(buffer);
client.uploadImage(fs.creatReadStream('xxx.jpg'));
- [docs] update docs and type for nlp config model #222
0.5.11 / 2017-11-22
messaging-api-messenger
- [new] support
getPageInfo
to get page name and page id using Graph API. For example:
client.getPageInfo().then(page => {
console.log(page);
// {
// name: 'Bot Demo',
// id: '1895382890692546',
// }
});
0.5.10 / 2017-11-21
messaging-api-slack
- [new] auto stringify
options.attachments
in SlackpostMessage
#208
0.5.9 / 2017-11-15
messaging-api-messenger
- [fix] make NLP config model value match Facebook API #207
0.5.8 / 2017-11-13
messaging-api-messenger
- [fix] make sure
options.messaging_type
works for all send apis #205
0.5.7 / 2017-11-09
A large update to support Messenger Platform 2.2. 🎉
Messaging Types
Messenger Team has created a messaging_type
property which is required in all requests to the send API. You can send it with messaging_type
option:
client.sendText(USER_ID, 'Awesome!', { messaging_type: 'RESPONSE' });
Available messaging types:
UPDATE
as defaultRESPONSE
using{ messaging_type: 'RESPONSE' }
optionsMESSAGE_TAG
using{ tag: 'ANY_TAG' }
optionsNON_PROMOTIONAL_SUBSCRIPTION
using{ messaging_type: 'NON_PROMOTIONAL_SUBSCRIPTION' }
options
New Message Tags
Two additional tags, PAIRING_UPDATE
and APPLICATION_UPDATE
, has been supported by passing as option:
client.sendGenericTemplate(
USER_ID,
[
{
//...
},
],
{ tag: 'PAIRING_UPDATE' }
);
client.sendGenericTemplate(
USER_ID,
[
{
//...
},
],
{ tag: 'APPLICATION_UPDATE' }
);
New Media Template - docs
In order to make image and video sharing more interactive, you can attach a CTA button to your media:
client.sendMediaTemplate(USER_ID, [
{
media_type: 'image',
attachment_id: '1854626884821032',
buttons: [
{
type: 'web_url',
url: 'https://en.wikipedia.org/wiki/Rickrolling',
title: 'View Website',
},
],
},
]);
Broadcast - docs
Create Message by createMessageCreative
To use the broadcast API, you must create messages using createMessageCreative
:
client
.createMessageCreative([
{
attachment: {
type: 'template',
payload: {
template_type: 'generic',
elements: [
{
title: 'Welcome to Our Marketplace!',
image_url: 'https://www.facebook.com/jaspers.png',
subtitle: 'Fresh fruits and vegetables. Yum.',
buttons: [
{
type: 'web_url',
url: 'https://www.jaspersmarket.com',
title: 'View Website',
},
],
},
],
},
},
},
])
.then(({ message_creative_id }) => {
// ...
});
Sending Broadcast or Sponsored Messages
After you got a message_creative_id
, you can send it as broadcast messages:
client.sendBroadcastMessage(message_creative_id);
Or sponsored messages:
client.sendSponsoredMessage(message_creative_id, {
message_creative_id: 938461089,
daily_budget: 100,
bid_amount: 400,
targeting: "{'geo_locations': {'countries':['US']}}",
});
Targeting Broadcast Messages - docs
You can manage your users with associated labels using following methods:
createLabel(name)
associateLabel(userId, labelId)
dissociateLabel(userId, labelId)
getAssociatedLabels(userId)
getLabelDetails(labelId, options)
getLabelList()
deleteLabel(labelId)
And send broadcast messages to only associated users:
client.sendBroadcastMessage(message_creative_id, { custom_label_id: LABEL_ID });
Estimating Broadcast Size - docs
To get the approximate number of people a broadcast message will be sent, you can use Estimating API:
startReachEstimation(customLabelId)
getReachEstimate(reachEstimationId)
Note: Due to the fact that reach estimation is a resource intensive process, it is executed in two steps.
More Configuration for Bulit-in NLP - docs
We have more parameters are supported now:
client.setNLPConfigs({
nlp_enabled: true,
model: 'custom',
custom_token: 'your_token',
verbose: true,
n_best: 8,
});
New Insights APIs
There are a bunch of insights APIs introduced in this version:
getInsights(metrics, options)
getBlockedConversations
getReportedConversations
getReportedConversationsByReportType
getBroadcastMessagesSent
Note:
getDailyUniqueConversationCounts
is deprecated.
Custom Event Logging - docs
Log custom events by using the Application Activities Graph API endpoint.
client.logCustomEvents({
appId: APP_ID,
pageId: PAGE_ID,
userId: USER_ID,
events: [
{
_eventName: 'fb_mobile_purchase',
_valueToSum: 55.22,
_fb_currency: 'USD',
},
],
});
Related Issue & PR
Support messenger platform 2.2 - #186
See more details in Messenger official release post and changelog.