diff --git a/.gitignore b/.gitignore index c3c36444b..41205213a 100755 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ examples/db_team_bot/ .DS_Store */.DS_Store .env +.idea diff --git a/lib/Facebook.js b/lib/Facebook.js index 0665b1b6d..c5917c76f 100644 --- a/lib/Facebook.js +++ b/lib/Facebook.js @@ -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}, diff --git a/readme-facebook.md b/readme-facebook.md index e02207215..153d83d60 100644 --- a/readme-facebook.md +++ b/readme-facebook.md @@ -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) { //...