Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FB payment settings API #1369

Merged
merged 2 commits into from
Jul 9, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/readme-facebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,21 @@ Remove the home_url setting

Get the home_url

### controller.api.messenger_profile.payment_settings()
| Argument | Description
|--- |---
| payload | A JSON object with the properties `privacy_url`, `public_key`, `testers`

View [the facebook documentation](https://developers.facebook.com/docs/messenger-platform/reference/messenger-profile-api/payment-settings) for more details.

### controller.api.messenger_profile.delete_payment_settings()

Remove the payment_settings setting

### controller.api.messenger_profile.get_payment_settings()

Get the payment_settings property of your bot's Messenger Profile

#### Using the The Messenger Profile API

```js
Expand Down
12 changes: 12 additions & 0 deletions lib/Facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,18 @@ function Facebookbot(configuration) {
get_home_url: function(cb) {
return facebook_botkit.api.messenger_profile.getAPI('home_url', cb);
},
payment_settings: function(payload) {
var message = {
payment_settings: payload
};
return facebook_botkit.api.messenger_profile.postAPI(message);
},
delete_payment_settings: function() {
return facebook_botkit.api.messenger_profile.deleteAPI('payment_settings');
},
get_payment_settings: function(cb) {
return facebook_botkit.api.messenger_profile.getAPI('payment_settings', cb);
},
postAPI: function(message) {
return new Promise(function(resolve, reject) {
var uri = 'https://' + api_host + '/' + api_version + '/me/messenger_profile?access_token=' + configuration.access_token;
Expand Down