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

Add FaceBook target audience #798

Merged
merged 7 commits into from
Apr 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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