Tag: facebook messenger

The Facebook Messenger Platform gives any Business the ability to have conversations with people on Messenger. Any Business can use Facebook Messenger to have more meaningful and personalized conversations if they are able to identify the Facebook user as customer who already has a customer account with your Business.

Facebook has come up with Account Linking feature that allows any Business to invite users to log-in using their own authentication flow and link with their customer account. This helps any business to provide a more secure, personalized and relevant experience to users.

Here is the Step by Step Guide on how any Business can use Facebook Messenger to link their Customer Account:

Assumption

Before I can explain how to Link an Account, I’m assuming that you have an understanding of how to use Facebook messenger for conversations with the users and already have build basic FB messenger Bot linked with backend. We will be focussing only on Account linking feature and will leave it for you to explore how the FB messenger can be used for linking Business Account.

Create a HTML or link your existing Login Page. This is your business hosted Login Page and is fully customizable by the business. Make sure the login page URL is on https else Facebook will not allow you to link the account.

The “url” above is the URL of the Login Page that is referred in Step 1 above. For more information refer Facebook documentation. The above URL is called <yourAccountLinkingUrl> by Facebook documentation

When on Facebook Messenger, FB user clicks on Login Button, the “url” defined above is invoked and redirect_uri and account_linking_token parameters are appended to your url. Both the parameters can be saved on the Login Page so that appropriate response can be passed to facebook after successful Login. Here is the snapshot of how the url will look like:

On Login Page, where there is business validation of successful login, at same place we need to move control to facebook by calling the redirect_uri and appending authorization_code

<redirect_uri>
&authorization_code=AUTHORIZATION_CODE

The authorization_code can be your customer id or any other token that helps to uniquely identify the business customer. For more details, Refer to Facebook Documentation

As soon as successful redirect happens to FB messenger, The Webhook permission will send account linking callback to the code with following details:

Authorization Code : This is the code that uniquely identifies the customer in your business database

Page Scope Id : This is the unique id of a Facebook user for a particular page that will be made available till the time the account is unlinked.

The Business app should save the Page Scope Id in your database so that when next time the same user comes we dont have to ask him to follow the Account Linking process.

Once all the above steps are completed, Any time the same Facebook user interacts on messenger with your business Bot, you will receive the same Page Scope Id which you can match with your database and provide personalized experience to your business customers.

I hope the above guide will help you link your Facebook Bot with your business account and help personalize customer experience.