Skip to content

Latest commit

 

History

History
57 lines (47 loc) · 8.42 KB

File metadata and controls

57 lines (47 loc) · 8.42 KB

Xatkit Facebook Messenger Platform

Wiki Badge Build Status

Receive and send messages to Facebook Messenger. This connector utilizes the Messenger Platform API. Installation instructions available in the wiki. An example can be found in the examples repo.

Providers

Provider Type Context Parameters Description
MessengerIntentProvider Intent, Event - title: The displayed text of a postback button
- payload: The payload of a postback button
- refferal.ref: The refferal ref attribute
- refferal.source The referral origin
- refferal.type: The refferal type
- mids: The id of a message as defined by a message delivery
- mid: The id of a message as referred to by a reaction
- watermark: The number of messages delivered
- emoji: The Unicode character of the emoji in a reaction
- reaction: The natural language interpretation of the emoji in a reaction
- raw_text: The raw text of a message
Receive webhook events from the Facebook API and translate them into Xatkit-compatible intents or events. Most of the context parameters correspond to the json properties of Messenger's Webhooks.

MessengerIntentProvider Events

Event Parameters Description
Message_Delivered - mids: The id of the delivered message Event sent when a message is delivered. Note: this event is only created when the xatkit.messenger.handle_deliveries is set to true.
Message_Read - watermark: The number of messages delivered Event sent when the user sees a message. Note: this event is only created when the xatkit.messenger.handle_read is set to true.
Message_React - mid: The id of the message reacted to
- emoji: The Unicode character of the emoji
- reaction: The natural language interpretation of the emoji
Event sent when the user reacts to a message. Note: this event is only created when the xatkit.messenger.handle_reactions is set to true.
Message_Unreact - mid: The id of the message the reaction was removed from Event sent when a reaction is removed from a message. Note: this event is only created when the xatkit.messenger.handle_reactions is set to true.
Message_Postback - title: The displayed text of a postback button
- payload: The payload of a postback button
- xatkit.messenger.postback.referral.ref: The refferal ref attribute
- xatkit.messenger.postback.referral.source The referral origin
- xatkit.messenger.postback.referral.type: The refferal type
Event sent when the user click on a postback button in a button template.

Actions

The user the message is sent to is recognized by an ID stored in the StateContext.

Action Parameters Return Return Type Description
MarkSeen - context (StateContext): context of the state this action was used in Response to the rest request to the API MessengerResponse Marks the user's last message as seen.
SendAction - context (StateContext): context of the state this action was used in
- senderAction (SenderAction): the action to send to the API
Response to the rest request to the API MessengerResponse Marks the user's last message as seen or turns the typing effect on or off.
UploadFile - context (StateContext): context of the state this action was used in
- file (File): the data object used to associate data about an uploaded file
Response to the rest request to the API MessengerResponse Uploads a file to Facebook and remembers its attachmentId.
SendFile - context (StateContext): context of the state this action was used in
- attacmentId (String): The attachmentId remembered from UploadFile
- attachmentType (Attachment.AttachmentType): The type of the attachment object as defined in the API
Response to the rest request to the API MessengerResponse Attaches an uploaded file to an attachment message and sends it to the user.
SendFile - context (StateContext): context of the state this action was used in
- file (File): the data object used to associate file-data and information about its attachment form
Response to the rest request of the SendFile method MessengerResponse Convenience Method that uses the UploadFile method if the file doesn't have an attachmentId and then sends the file with the SendFile method.
Reply - context (StateContext): context of the state this action was used in
- text (String): text to send as a message
Response to the rest request to the API MessengerResponse Converts the text to a message and sends it to the user.
Reply - context (StateContext): context of the state this action was used in
- text (String): text to send as a message
- naturalize (Boolean): used to turn on text naturalization
Response to the rest request to the API MessengerResponse Naturalized the text, then sends the message to the user. Note: You need to set xatkit.messenger.naturalize_text true for the naturalization to go true.
Reply - context (StateContext): context of the state this action was used in
- message (Message): the message data object as defined by the API
Response to the rest request to the API MessengerResponse Sends the message to the user.
Reply - context (StateContext): context of the state this action was used in
- attachment (Attachment) the attachment data object as defined by the API
Response to the rest request to the API MessengerResponse Attaches the attachment to a message and sends it to the user.

Options

The Messenger Platform supports the following configuration options.

Key Values Description Constraint
xatkit.messenger.verify_token String The Messenger token given to the API to connect to the bot Mandatory
xatkit.messenger.access_token String The Messenger token used by the bot to connect to the API Mandatory
xatkit.messenger.app_secret String The Messenger encryption secret Mandatory
xatkit.messenger.handle_reactions Boolean Generate events from when the user reacts to a message Optional (default false)
xatkit.messenger.handle_deliveries Boolean Generate events when a message is delivered Optional (default false)
xatkit.messenger.handle_reads Boolean Generate events when the user reads a message Optional (default false)
xatkit.messenger.intent_from_postback Boolean Generate intents instead of events when the user interacts with the postback button Optional (default false)
xatkit.messenger.intent_from_reaction Boolean Generate intents instead of events when the user reacts to a message Optional (default false)
xatkit.messenger.use_reaction_text Boolean Use natural language interpretations of emojis instead of emojis themselves when generating intents from reactions Optional (default false)
xatkit.messenger.use_title_text Boolean Use the button titles instead of their payloads when generating intents from postbacks Optional (default false)
xatkit.messenger.auto_seen Boolean Automatically mark the user's messages as seen Optional (default false)
xatkit.messenger.naturalize_text Boolean Naturalize text when using the method that naturalizes text Optional (default false)