Skip to content

Account Linking

Maxi Ferreira edited this page Aug 5, 2016 · 1 revision

If you want to use Account Linking on your bot, you can subscribe to the account_linking event with your bot instance. For example:

bot.on('account_linking', (payload, chat) => {
  const status = payload.account_linking.status;
  // status will be 'linked' or 'unlinked'
});

Your payload will have the format specified in the Account Linking Documentation

And to send a Login or Logout button, you can use any of the methods provided by bootbot like sendButtonTemplate or sendGenericTemplate. For example:

chat.sendGenericTemplate([{
  "title": "Welcome to M-Bank",
  "image_url": "http://www.example.com/images/m-bank.png",
  "buttons": [{
    "type": "account_link",
    "url": "https://www.example.com/oauth/authorize"
  }]
}]);
Clone this wiki locally