Supplementary Documentation for Facebook Messenger Platform

Reference: https://developers.facebook.com/docs/messenger-platform

Handle all data types in the callback


There is only one callback url for all Messenger events. The type of callback (for example when a message is submited by a user to your page) is determined by the data payload attached to the POST callback to your url. There is no clearly obvious field in the data to identify the type of callback. It is necessary to unravel the json object received to figure out what type of callback it is.

Depending on the language you are using for your web coding, it may be straightforward or complicated to even find out which json class the payload belongs to.

The Facebook documentation does not specify the various json formats the Webhook can send. It merely gives one example each of the five types listed. There is minimal or no description of what each data field mean. You are expected to figure out from their English field names.

Design your code to handle gracefully all json data structures, including those you are not interested in or are not ready to process. If you don't, and if your web server hits an exception, it will return a 500 Internal server error and Facebook will automatically disable your Webhook.

Comments

Popular posts from this blog

Attack Lab - Level 5 explained

Setting to English for the Xiaomi Wifi Router

Assembly version, File version, Product version