Skip to content

Instagram comment automation silently never replies (two separate bugs) #863

Closed

Description

@peetorres

Self-hosted, community edition, Instagram Business Login. App published, webhook verified, account connected, permissions granted.

Incoming comments create the contact and the inbox message correctly, but a private reply is never delivered — and nothing is logged as an error. Two independent bugs, either of which is enough to produce complete silence.

1. Comment automations are always stored with type = messenger

FBCommentAutomation.type has messenger as its column default, and the create form at /fb-comments/create never exposes a channel selector, so every automation is saved as messenger.

The worker resolves automations using the channel derived from the incoming event:

const channelType = integrationType;              // "instagram"
const automations = await fbCommentAutomationService
  .findActiveAutomations({ workspaceId, channelType });

For an Instagram comment this never matches, so the loop body never runs and no log line is emitted. The enum already accepts instagram, so the workaround is:

UPDATE "FBCommentAutomation" SET type = 'instagram' WHERE id = '...';

Passing ?type=instagram on the create URL has no effect.

2. Text private replies are Messenger-only

In executePrivateReply:

if (privateReply.type === "text" && privateReply.value) {
  if (ctx.channelType === "messenger") await sendPrivateReply(...);
  return;                       // instagram returns here, sending nothing
}

On Instagram the function returns without sending and without throwing. Because no exception reaches the caller, dispatchFailed stays false, so the dedup row is inserted and repliesCount is incremented — the UI reports replies that never left the server. Confirmed by an empty chat queue and zero outgoing rows in Message.

The flow and AIAgent branches enqueue a job for any channel, so setting the private reply to a Flow works around this.

Suggested fixes

  1. Expose the channel on the automation form (or infer it from the connected channel), and/or filter with the correct type when the workspace only has Instagram connected.
  2. Either implement the Instagram path for text private replies, or make the unsupported combination fail loudly instead of silently succeeding — the silent success is what makes this hard to diagnose.

Happy to open a PR for either one.

Activity

  1. peetorres commented on Jul 28, 2026

    @peetorres
    Author

    Third instance of the same root cause, found while wiring an AI Agent as the private reply of an Instagram comment automation.

    In processCommentAIReply, the private delivery path is also Messenger-only:

    if (data.replyChannel === "public") {
      await postPublicCommentReply({ ... });
      return;
    }
    
    if (data.channelType === "messenger") {
      const { integrationRow } = await integrationService
        .identifyInboxAndIntegrationAuthFromIdentifier(data.integrationType, data.integrationIdentifier);
      await sendPrivateReply(integrationRow.auth, data.commentId, generated.text);
    }

    On Instagram the function reaches the end and returns without sending. Nothing throws, so BullMQ marks the job completed successfully. Observed: commentAIReply job finished at 14:23:43 with no log line and no outgoing message, while the public reply for the same comment went out normally a few seconds earlier.

    So the same silent-success shape now shows up in three places:

    1. FBCommentAutomation.type defaults to messenger and the UI never lets you pick the channel.
    2. executePrivateReply — text replies are Messenger-only.
    3. processCommentAIReply — AI Agent private replies are Messenger-only.

    The practical consequence is that AI Agent as a private reply to an Instagram comment cannot work, with no configuration that fixes it, and no signal that anything is wrong. Going through a Flow is the only working path.

    Suggested fix, same as before: either implement the Instagram branch, or make the unsupported combination fail loudly. A job that sends nothing should not complete successfully.

  2. sung17 commented on Aug 3, 2026

    @sung17
    Collaborator

    Thanks for the detailed writeup — went through the current main branch to check on both.

    1. Automations always stored with type = messenger — already fixed on main. Instagram automations aren't created through /fb-comments/create (that route is Messenger-only by design, type pinned to "messenger"). There's a dedicated /ig-comments/create flow where type is a required variant param (instagram / instagramFacebook) with no default — if it's missing you get redirected back to the list instead of silently defaulting. So ?type=instagram on the FB form being a no-op is expected, not the bug path for IG.

    2. executePrivateReply is Messenger-only for text replies — already fixed on main (landed via #874, on top of earlier fixes in #834/#831/#706). It now dispatches all three channels: sendPrivateReply for messenger, sendInstagramLoginPrivateReply for instagram, sendInstagramFacebookPrivateReply for instagramFacebook.

    3. processCommentAIReply (AI Agent private reply) — still broken. This one from @peetorres's comment is real and still present on main. In apps/worker/src/integration/handlers/comment-automation/ai-reply.ts, the private-DM branch only checks data.channelType === "messenger"; for instagram/instagramFacebook it falls off the end of the function with no send, no throw, and no log line — same silent-success shape described above, just not yet ported to this file. The IG send functions it needs already exist and are used elsewhere (sendInstagramLoginPrivateReply / sendInstagramFacebookPrivateReply), they're just not wired into this path.

    So the remaining actionable bug here is #3 — happy to see a PR for that one if you'd like to send it, otherwise we'll get it fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions