class Facebook.generate.Generate[source]

Bases: object

static button(button_type, title='None', url=None, payload=None, webview_height='full')[source]

Creates a button and returns the dictionary containing the button data

For more info https://developers.facebook.com/docs/messenger-platform/send-api-reference/buttons

Parameters:
  • button_type (str) – Type of button.
  • title (str) – Title of the button. Max 20 characters.
  • url (str) – This URL is opened in a mobile browser when the button is tapped.
  • payload (str) – This data will be sent back to your webhook. 1000 character limit.
  • webview_height (str) – Height of the Webview. Valid values: compact,tall,full.
Returns:

A dictionary containing mapping between proper keys and arguments.

Return type:

dict

static element(title, subtitle=None, image_url=None, buttons=None)[source]

Generates payload for element

Parameters:
  • title (str) – Bubble title.
  • subtitle (str) – Bubble subtitle.
  • image_url (str) – Bubble image.
  • buttons (list) – Set of buttons that appear as call-to-actions.
Returns:

A dictionary containing mapping between proper keys and arguments.

Return type:

dict

static quick_reply(content_type, title=None, payload=None, image_url=None)[source]

This method creates a dict for a quick_reply

Parameters:
  • content_type (str) – text or location
  • title (str) – Caption of button
  • payload (str) – Custom data that will be sent back to you via webhook
  • image_url (str) – URL of image for text quick replies
Returns:

dict containing quick_reply

Return type:

dict