Chatfuel

Tips and Tricks

Account Linking

We receive many questions about Account Linking in Chatfuel.

We 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 your bot’s {{fb_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 {{fb_id}} attribute to the URL. Example: https://yourdomain.com/auth_page/?bot_id={{fb_id}}
  2. If the user is not authorized 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 {{fb_id}}. Viola! Store the user’s {{fb_id}} in your website’s database.
  4. Display a suggestion to close the webview and return to the bot. *
  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 {{fb_id}}.

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

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

* You’ll be able to close a webview window using an API call immediately following successful authorization after we roll out the Messenger extension support.