Yes, my facebook.py is pretty much exactly the native rasa_core/channels/facebook.py 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 typepostback
. 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 actions.py 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": [...]
}
]
dispatcher.utter_custom_message(*elements)