Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 7942701

Browse files
author
Ben Brown
authored
Merge pull request #798 from ouadie-lahdioui/faceBookTargetAudience
Add FaceBook target audience
2 parents f09873a + 2227bde commit 7942701

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

docs/readme-facebook.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,7 @@ controller.api.messenger_profile.get_account_linking(function (err, accountLinki
474474
controller.api.messenger_profile.delete_account_linking();
475475
controller.api.messenger_profile.domain_whitelist('https://localhost');
476476
controller.api.messenger_profile.domain_whitelist(['https://127.0.0.1', 'https://0.0.0.0']);
477-
controller.api.messenger_profile.delete_domain_whitelist('https://localhost');
478-
controller.api.messenger_profile.delete_domain_whitelist(['https://127.0.0.1', 'https://0.0.0.0']);
477+
controller.api.messenger_profile.delete_domain_whitelist();
479478
controller.api.messenger_profile.get_domain_whitelist(function (err, data) {
480479
console.log('****** Whitelisted domains :', data);
481480
});
@@ -492,14 +491,19 @@ controller.api.messenger_profile.get_home_url(function (err, data) {
492491

493492
controller.api.messenger_profile.delete_home_url();
494493

495-
controller.hears(['hello'],'facebook_postback', function(bot, message) {
496-
//...
494+
// Target Audience
495+
controller.api.messenger_profile.target_audience({
496+
"audience_type":"custom",
497+
"countries":{
498+
"whitelist":["US", "CA"]
499+
}
497500
});
498-
499-
controller.hears(['help'],'facebook_postback', function(bot, message) {
500-
//...
501+
controller.api.messenger_profile.delete_target_audience();
502+
controller.api.messenger_profile.get_target_audience(function (err, data) {
503+
console.log('****** Target Audience :', data);
501504
});
502505

506+
503507
```
504508

505509

lib/Facebook.js

+12
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,18 @@ function Facebookbot(configuration) {
493493
get_domain_whitelist: function(cb) {
494494
facebook_botkit.api.messenger_profile.getAPI('whitelisted_domains', cb);
495495
},
496+
target_audience: function(payload) {
497+
var message = {
498+
'target_audience': payload
499+
};
500+
facebook_botkit.api.messenger_profile.postAPI(message);
501+
},
502+
delete_target_audience: function() {
503+
facebook_botkit.api.messenger_profile.deleteAPI('target_audience');
504+
},
505+
get_target_audience: function(cb) {
506+
facebook_botkit.api.messenger_profile.getAPI('target_audience', cb);
507+
},
496508
home_url: function(payload) {
497509
var message = {
498510
home_url: payload

0 commit comments

Comments
 (0)