MessengerExtensions.getGrantedPermissions()
ReferenceThis method is a part of the Messenger Extensions SDK. For information on including the SDK in your site, see Add Messenger Extensions SDK.
The getGrantedPermissions()
method of the Messenger Extensions SDK allows you to retrieve a list of permissions you are currently granted by the person that opened the webview.
When a person begins a conversation with the bot for the first time, these permissions are implicitly granted. There may be other situations where only one (or neither) is granted, such as encountering the bot via a plugin or ad, or encountering a page shared by a friend using a bot.
Permission | Scope | Description |
---|---|---|
| Per user, per bot. | Once granted, the developer may call the user profile API to obtain more information about the user. |
| Per user, per bot. | Once granted, the bot may message the user personally in a user-to-bot thread. |
MessengerExtensions.getGrantedPermissions(success, error)
MessengerExtensions.getGrantedPermissions(function (permissions_response) {
let permission = permissions_response.permissions // list of permissions granted
}, function() {
// An error occurred
});
Parameter | Type | Description |
---|---|---|
| Function | Success callback function. Called if the Messenger Platform successfully retrieves the permission list. Receives the permission_response object as an argument. |
| Function | Error callback function. Called if Messenger was unable to retrieve the permission list. |
permission_response
ObjectThe permission_response
object is passed to the success callback.
{
"permissions":[
"user_profile",
"user_messaging"
]
}
Property | Type | Description |
---|---|---|
| Array<String> | A list of the permissions that are currently granted. |