Prerequisites
- A Meta Developers app with Messenger access
- A valid Access Token with page permissions
- The Page ID for the Facebook Page that will receive messages
Meta App Secret and API URL
The Meta App Secret belongs to the Meta App connected to this workspace. Do not configureappSecret as a global SendBot environment variable.
When creating the Facebook credential in Studio, provide the App Secret together with the account credentials. SendBot stores it encrypted with the workspace credential and uses it only to validate webhook signatures for that credential.
Configure the public API URL used by Studio:
- Each connected Meta App can have a different App Secret.
NEXT_PUBLIC_SENDBOT_API_URLmust point to your public API so Studio can generate the webhook URL.- In a local environment, use a public URL such as
https://<your-ngrok>.ngrok.ioand make sure HTTPS is enabled.
Webhook Configuration in Meta
In Meta Developers:- Open Webhooks and add an endpoint for Page.
- Use the webhook URL generated by Studio:
- Generate the Verification Token in Studio and provide it in Meta to validate the signature.
- Select message events to receive DMs.
- For comments, also enable the Comments events on the same webhook.
Studio Configuration
- Go to Share on the bot -> Facebook.
- Create the credentials:
- Access Token
- Meta App Secret
- Page ID
- Click Generate token and copy the Verification Token.
- Configure the webhook in Meta with the URL and token.
- Enable Enable Facebook integration and publish the bot.
Comment Replies
In Studio, you can enable automatic replies to comments:- Open Share on the bot -> Facebook.
- In Comments, enable Enable comment replies.
- Choose the Reply mode:
- Public reply: replies on the comment
- DM only: sends a DM to the user
- Public + DM: replies on the comment and sends a DM
- Optional: define the Start condition (comments) to filter which comments start the bot.
- Publish the bot.
Production Checklist
appSecretconfigured in the backend- Public API URL configured in Studio
- Webhook validated in Meta using the token generated by Studio
- Credentials saved and integration enabled on the bot
- Comments events enabled on the webhook if you use comment replies
Quick Troubleshooting
- Webhook 401: invalid signature or incorrect token
- Webhook 500: missing
appSecretor unsigned request body - No reply: make sure the Page is connected to the Meta app and the correct events are enabled