Overview
This node enables sending various types of messages through Facebook Messenger. It supports sending plain text, media files (images, audio, video, files), and rich template messages such as generic templates, button templates, and media templates. Additionally, it can mark messages as seen or send typing indicators to simulate user activity.
Common scenarios include:
- Automating customer support responses with text or media.
- Sending interactive message templates with buttons for user engagement.
- Notifying users with media-rich content like images or videos.
- Indicating typing status to improve conversational experience.
Practical example: A chatbot sends a generic template showcasing product images with buttons linking to purchase pages, or a support bot sends a quick "typing..." indicator while processing a request.
Properties
| Name | Meaning |
|---|---|
| Recipient ID | The Page-Scoped ID (PSID) or thread ID of the recipient to whom the message will be sent. |
| Template Type | The type of template message to send. Options: Generic (image, title, subtitle, buttons), Button (text with buttons), Media (image or video with buttons). |
| Elements | For Generic template: List of elements each containing title, subtitle, image URL, default action URL, and optional buttons. |
| Text | For Button template: The main text displayed above the buttons. |
| Buttons | For Button template: Collection of buttons with type (Web URL or Postback), title, and either URL or payload depending on type. |
| Media Type | For Media template: The type of media to send, either Image or Video. |
| Media URL | For Media template: The URL of the media file to send. |
| Add Buttons | For Media template: Whether to add buttons to the media template. |
| Buttons (Media) | For Media template when adding buttons: Collection of buttons similar to those in Button template. |
| Recipient ID | The Page-Scoped ID (PSID) or thread ID of the recipient. |
Output
The node outputs JSON data representing the response from the Facebook Graph API after sending the message or performing the action. This typically includes message IDs or confirmation of actions like marking seen or typing indicators.
If an error occurs and "Continue On Fail" is enabled, the output JSON contains an error field with the error message.
No binary data output is produced by this node.
Dependencies
- Requires a valid Facebook Messenger API access token credential configured in n8n.
- Internet access to call the Facebook Graph API endpoint
https://graph.facebook.com/v17.0/me/messages. - Proper permissions granted to the Facebook app to send messages on behalf of the page.
Troubleshooting
- Invalid Recipient ID: If the recipient ID is incorrect or not associated with the page, the API will return an error. Verify the PSID or thread ID.
- Missing or Invalid Access Token: Ensure the Facebook Messenger API credential is correctly set up with a valid access token.
- Template Validation Errors: Templates must conform to Facebook's format; missing required fields like titles or URLs may cause errors.
- Button Payload Issues: For postback buttons, ensure the payload is provided; for web URL buttons, ensure the URL is valid.
- Network or API Errors: Check internet connectivity and Facebook API status if requests fail.
- Permission Denied: The Facebook app must have messaging permissions approved and the page must be subscribed to the app.
Common error messages are returned from the Facebook API and included in the node output under the error key if "Continue On Fail" is enabled.