Skip to content

Commit

Permalink
Merge pull request #798 from ouadie-lahdioui/faceBookTargetAudience
Browse files Browse the repository at this point in the history
Add FaceBook target audience
  • Loading branch information
Ben Brown committed Apr 26, 2017
2 parents f09873a + 2227bde commit 7942701
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
18 changes: 11 additions & 7 deletions docs/readme-facebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,7 @@ controller.api.messenger_profile.get_account_linking(function (err, accountLinki
controller.api.messenger_profile.delete_account_linking();
controller.api.messenger_profile.domain_whitelist('https://localhost');
controller.api.messenger_profile.domain_whitelist(['https://127.0.0.1', 'https://0.0.0.0']);
controller.api.messenger_profile.delete_domain_whitelist('https://localhost');
controller.api.messenger_profile.delete_domain_whitelist(['https://127.0.0.1', 'https://0.0.0.0']);
controller.api.messenger_profile.delete_domain_whitelist();
controller.api.messenger_profile.get_domain_whitelist(function (err, data) {
console.log('****** Whitelisted domains :', data);
});
Expand All @@ -492,14 +491,19 @@ controller.api.messenger_profile.get_home_url(function (err, data) {

controller.api.messenger_profile.delete_home_url();

controller.hears(['hello'],'facebook_postback', function(bot, message) {
//...
// Target Audience
controller.api.messenger_profile.target_audience({
"audience_type":"custom",
"countries":{
"whitelist":["US", "CA"]
}
});

controller.hears(['help'],'facebook_postback', function(bot, message) {
//...
controller.api.messenger_profile.delete_target_audience();
controller.api.messenger_profile.get_target_audience(function (err, data) {
console.log('****** Target Audience :', data);
});


```


Expand Down
12 changes: 12 additions & 0 deletions lib/Facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,18 @@ function Facebookbot(configuration) {
get_domain_whitelist: function(cb) {
facebook_botkit.api.messenger_profile.getAPI('whitelisted_domains', cb);
},
target_audience: function(payload) {
var message = {
'target_audience': payload
};
facebook_botkit.api.messenger_profile.postAPI(message);
},
delete_target_audience: function() {
facebook_botkit.api.messenger_profile.deleteAPI('target_audience');
},
get_target_audience: function(cb) {
facebook_botkit.api.messenger_profile.getAPI('target_audience', cb);
},
home_url: function(payload) {
var message = {
home_url: payload
Expand Down

0 comments on commit 7942701

Please sign in to comment.