Pré-requisitos
- Um app no Meta Developers com acesso ao Messenger
- Um Access Token válido com permissões da página
- O Page ID da página do Facebook que vai receber as mensagens
Configuração do backend (API)
In your API environment, both production and staging, configure:- The Meta App Secret is stored encrypted with the workspace credential and is used to validate webhook signatures for that credential.
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.
Configuração do webhook na 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.
Configuração no Studio
- 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.
Respostas em comentários
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.
Checklist de produção
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
Solução rápida de problemas
- 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