We receive many questions about Account Linking in Chatfuel.

This article will show you a slightly different (easier) way of implementing this functionality as we find it hard to follow the existing procedures involving 3 backends – yours, Facebook’s and ours.

What you’ll be able to do using Account Linking:

  • Match the {{messenger user id}} attribute to your website’s logged in users

  • Utilize users’ preferences from your website to fine-tune the bot’s experience

  • Pass back users’ preferences from the bot to your website

Here is how:

  1. Create a card with a button leading to your website’s auth URL. Put {{messenger user id}} attribute to the URL. Example: https://yourdomain.com/auth_page/?user_id={{messenger user id}}

  2. If the user is not authorised on your website, let them log in. Otherwise, go to step 3.

  3. Now your user is authorized on your website and you know their {{messenger user id}}. Viola! Store the user’s {{messenger user id}} in your website’s database.

  4. Display a suggestion to close the webview and return to the bot or close the webview using Messenger Extensions.

  5. Inform the user that Account Linking has successfully finished via a Broadcasting API call.

Now after each user action, you want to store, you may pass the action’s result to your backend via the JSON API plugin, matching the user by {{messenger user id}}.

Vice-versa you can personalize your bot’s behaviour using the JSON API plugin that will load customized data from your website.

Additionally, you can send a personalised broadcast to any of your linked website users via the Broadcasting API.

Did this answer your question?