ChatbotX icon indicating copy to clipboard operation
ChatbotX copied to clipboard

Instagram via Facebook Login: read receipts are dropped (instagramReadSchema requires `watermark`, Instagram sends only `mid`)

Open andreus1610 opened this issue 3 weeks ago • 0 comments

Version: 1.17.1 (same code in 1.20.0 and main)

What happens: with the "Instagram via Facebook" integration, every Instagram read-receipt webhook is rejected by the builder with "instagram facebook webhook payload unrecognized — skipping", issue invalid_type at entry.0.messaging.0.read.watermark. contactLastReadAt is never set and "seen" stays at 0 for Instagram (Messenger is fine). 209 such warnings in 5 days on our instance.

Why: integrations/instagram-facebook/src/schema.ts, line 140: watermark: z.number(). Instagram's messaging_seen webhook sends read: { mid } without watermark (Meta docs, "Webhooks for Instagram Messaging"). integrations/instagram/src/schema.ts, line 149, already has watermark: z.number().optional().

Side effect: when parsing fails the whole payload is skipped, so a batch with a read and a message would lose the message too.

Suggested fix: watermark: z.number().optional(), as in the Instagram Login integration.

Repro: send a DM from the inbox to an Instagram contact, open it in Instagram; the builder logs the warning in the same second.

andreus1610 avatar Nov 10 '26 11:11 andreus1610