rasa.core.channels.facebook
Messenger Objects
class Messenger():
async def message(self, message: Dict[Text, Any], metadata: Optional[Dict[Text, Any]])->None:
pass # Handle an incoming event from the fb webhook.
async def postback(self, message: Dict[Text, Any], metadata: Optional[Dict[Text, Any]])->None:
pass # Handle a postback (e.g. quick reply button).
MessengerBot Objects
class MessengerBot(OutputChannel):
def send(self, recipient_id: Text, element: Any)->None:
pass # Sends a message to the recipient using the messenger client.
async def send_text_message(self, recipient_id: Text, text: Text, **kwargs: Any)->None:
pass # Send a message through this channel.
async def send_image_url(self, recipient_id: Text, image: Text, **kwargs: Any)->None:
pass # Sends an image.
async def send_action(self, recipient_id: Text, sender_action: Text)->None:
pass # Sends a sender action to facebook.
async def send_text_with_buttons(self, recipient_id: Text, text: Text, buttons: List[Dict[Text, Any]], **kwargs: Any)->None:
pass # Sends buttons to the output.
async def send_quick_replies(self, recipient_id: Text, text: Text, quick_replies: List[Dict[Text, Any]], **kwargs: Any)->None:
pass # Sends quick replies to the output.
async def send_elements(self, recipient_id: Text, elements: Iterable[Dict[Text, Any]], **kwargs: Any)->None:
pass # Sends elements to the output.
async def send_custom_json(self, recipient_id: Text, json_message: Union[List, Dict[Text, Any]], **kwargs: Any)->None:
pass # Sends custom json data to the output.
FacebookInput Objects
class FacebookInput(InputChannel):
def __init__(self, fb_verify: Text, fb_secret: Text, fb_access_token: Text)->None:
pass # Create a facebook input channel.
@staticmethod
def validate_hub_signature(app_secret: Text, request_payload: bytes, hub_signature_header: Text)->bool:
pass # Make sure the incoming webhook requests are properly signed.
Arguments:
recipient_id- recipientsender_action- action to send, e.g. "typing_on" or "mark_seen"fb_verify- FB Verification stringfb_secret- facebook application secretfb_access_token- access token to post in the name of the FB pageapp_secret- Secret Key for applicationrequest_payload- request bodyhub_signature_header- X-Hub-Signature header sent with request
Returns:
bool- indicated that hub signature is validated.