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

Add Facebook thread setting account linking URL #645

Merged
merged 5 commits into from
Feb 22, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ examples/db_team_bot/
.DS_Store
*/.DS_Store
.env
.idea
14 changes: 14 additions & 0 deletions lib/Facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,20 @@ function Facebookbot(configuration) {
};
facebook_botkit.api.thread_settings.deleteAPI(message);
},
account_linking: function(payload) {
var message = {
'setting_type': 'account_linking',
'account_linking_url': payload
};
facebook_botkit.api.thread_settings.postAPI(message);
},
delete_account_linking: function() {
var message = {
'setting_type': 'call_to_actions',
'thread_state': 'existing_thread'
};
facebook_botkit.api.thread_settings.deleteAPI(message);
},
postAPI: function(message) {
request.post('https://graph.facebook.com/v2.6/me/thread_settings?access_token=' + configuration.access_token,
{form: message},
Expand Down
3 changes: 3 additions & 0 deletions readme-facebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ controller.api.thread_settings.menu([
"url":"https://github.com/howdyai/botkit/blob/master/readme-facebook.md"
},
]);
controller.api.thread_settings.account_linking('https://www.yourAwesomSite.com/oauth?response_type=code&client_id=1234567890&scope=basic');
controller.api.thread_settings.delete_account_linking();


controller.hears(['hello'],'facebook_postback', function(bot, message) {
//...
Expand Down