Skip to main content
Open in Hubv The official Messenger and Facebook integration allows users to chat with your bot by messaging a Facebook page.

Setup

You will need:
  1. In Botpress Studio, select Explore Hub in the upper-right corner.
  2. Search for the Messenger integration, then select Install Integration.
  3. In the Configuration menu, select Authorize Messenger.
  4. Follow the instructions to connect Botpress to your Messenger account.

Options

The Messenger integration’s Configuration menu offers a few additional options:

Get user profile

When this option is enabled (default), the integration will update the Botpress user’s name and picture URL with data from Messenger.
This option is only available with manual configuration.

Download media

When enabled, this option automatically downloads media files using the Files API. When disabled, media files are displayed using their Messenger media URL.

Downloaded media expiry

Expiry time (in hours) for downloaded media files. An expiry time of 0 means the files will never expire. Defaults to 24 hours.

Replying to comments in DM

You can configure your bot to reply to user comments in a direct message (DM).

Step 1: Check where the conversation started

First, add a router Node that checks whether the conversation originated from a user’s comment.
1
In Botpress Studio, enter your Main Workflow.
2
Add a new Node to the Workflow.
3
Rename the Node to Router, then move it between the Start Node and any other existing Nodes:
Reply to comments in DMs 1
4
Add two Expression Cards to the Router Node.
5
Open the second Expression Card’s inspector. Next to the Condition field, toggle to disable generative AI.
6
Configure this Card for conversations started normally:
  • In the Label field, paste in: Conversation started
  • In the Condition field, paste in: {{event.channel == 'channel'}}
7
Open the first Expression Card’s inspector. Next to the Condition field, toggle to disable generative AI.
8
Configure this Card for conversations started from a comment reply:
  • In the Label field, paste in: Conversation started from comment
  • In the Condition field, paste in: {{event.channel == 'commentReplies'}}
9
Attach the Start Node to the Router Node. Then, attach the Conversation started Expression Card to your regular conversation logic:
Reply to comments in DMs 2

Step 2: Reply to the user’s comment

Next, add logic to reply to the user’s comment. This lets them know that the bot will continue the conversation in a DM.
1
Add a new Node to your Workflow and rename it to Reply_to_comment.
2
Add a Text Card to the new Node.
3
Open the Text Card’s inspector.In the Message to send field, enter the message you want to reply to the user’s comment. For example: Check your DMs!.
4
Attach the Conversation started from comment Expression Card to the Reply_to_comment Node:
Reply to comments in DMs 3

Step 3: Start a DM conversation from the comment

Finally, add logic to start a DM conversation whenever a user leaves a comment.
1
Add a new Node to your Workflow and rename it to DM_reply.
2
Add the Start DM Conversation from Comment Card to the new Node.
3
Open the Start DM Conversation from Comment Card’s inspector.
  • In the Comment ID field, paste in: {{event.payload.commentId}}
  • In the Message field, enter the first message you want to send the user in a DM. For example: Hey! Received your comment.
If you want to send the user’s original comment back to them, you can add {{event.payload.text}} to the Message field.
4
Attach the Reply_to_comment Node to the DM_reply Node. Then, attach the DM_reply Node to the End Node:
Reply to comments in DMs 4
When a user comments on a post, your bot will now:
  • Reply to their comment, letting them know to check their DMs
  • Continue the conversation in a DM
You can further modify your Workflow depending on your desired behaviour.

Cards

Here’s a reference for all Cards available with the integration:

Get or Create a Conversation

Get or Create a User

Start DM Conversation from Comment

output
object
This Card has no output.

Tags

You can read event tags to get information about an active Messenger conversation:

Message ID

To get the Messenger ID of a message:
event.tags.message["messenger:id"]

Recipient ID

To get the Messenger ID of the recipient:
event.tags.message["messenger:recipientId"]

Sender ID

To get the Messenger ID of the sender:
event.tags.message["messenger:senderId"]

Conversation ID

To get the Messenger ID of the conversation:
event.tags.conversation["messenger:id"]

User ID

To get the Messenger ID of the user:
event.tags.user["messenger:id"]
Last modified on January 21, 2026