Getting user data in Facebook Messenger

Yes, my is pretty much exactly the native rasa_core/channels/ except that three methods were customized:

  • MessengerBot.send_custom_message does not include the self._add_postback_info(element['buttons']) line anymore because this forces every button to be of type postback. Thus, you e.g. cannot create a generic button.
  • Messenger._handle_user_message uses the custom MessengerBot instead of the rasa_core’s
  • FacebookInput.blueprint.webhook instantiates the custom Messenger instead of rasa_core’s Messenger

The last two are literally just there to make sure the custom MessengerBot is inside FacebookInput instead of rasa_core’s.

In your you can just use it like this in any of the run methods:

# Create your (button) elements according to Messenger Platform API specs
elements = [
        "title": "title",
        "image_url": "url",
        "buttons": [...]