Este guia mostra como configurar o canal Instagram no Sendbot, backend e Studio, para receber e responder mensagens via DMs e comentários.

Pré-requisitos

  • A Meta Developers app with Instagram Messaging access
  • A valid Instagram Access Token
  • The Instagram User ID of the account that will receive messages

Configuração do backend (API)

In your API environment, both production and staging, configure:
Notas importantes
  • 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_URL must 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.io and make sure HTTPS is enabled.

Configuração do webhook na Meta

In Meta Developers:
  1. Open Webhooks and add an endpoint for Instagram.
  2. Use the webhook URL generated by Studio:
  1. Generate the Verification Token in Studio and provide it in Meta to validate the signature.
  2. Select Instagram messaging events to receive DMs.
  3. For comments, also enable the Comments events on the same webhook.

Configuração no Studio

  1. Go to Share on the bot -> Instagram.
  2. Create the credentials:
    • Access Token
    • Meta App Secret
    • Instagram User ID
    • Optional: Facebook Page ID
  3. Click Generate token and copy the Verification Token.
  4. Configure the webhook in Meta with the URL and token.
  5. Enable Enable Instagram integration and publish the bot.

Respostas em comentários

In Studio, you can enable automatic replies to comments:
  1. Open Share on the bot -> Instagram.
  2. In Comments, enable Enable comment replies.
  3. 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
  4. Optional: define the Start condition (comments) to filter which comments start the bot.
  5. Publish the bot.

Checklist de produção

  • appSecret configured 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 appSecret or unsigned request body
  • No reply: make sure the Instagram account is connected to the Meta app and the correct events are enabled