Repository navigation
fix(instagram-facebook): accept read receipts without watermark - #1696
Merged
realcodesiman merged 1 commit intoNov 11, 2026
Merged
realcodesiman merged 1 commit into
realcodesiman merged 1 commit into
Conversation
Instagram messaging_seen sends read.mid and omits watermark. Requiring watermark rejected the whole webhook, so the read and any batched message were dropped. Match the Instagram Login schema and keep the event timestamp on the contactMarkAsRead payload.
hello-jackytruong
referenced
this pull request
in hello-jackytruong/ChatWorkAI
Nov 22, 2026
Instagram messaging_seen sends read.mid and omits watermark. Requiring watermark rejected the whole webhook, so the read and any batched message were dropped. Match the Instagram Login schema and keep the event timestamp on the contactMarkAsRead payload. Co-authored-by: Mark David Prado <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1687
What changed
instagramReadSchemain the Instagram via Facebook Login integration now haswatermark: z.number().optional(), the same as the Instagram Login integration (integrations/instagram/src/schema.ts).Why
Instagram's
messaging_seenwebhook sendsread: { mid }and nowatermark. The schema requiredwatermark, so Zod rejected the whole webhook body (invalid_typeatentry.0.messaging.0.read.watermark) and the handler skipped it.contactLastReadAtwas never set for Instagram contacts, and a message that arrived in the same batch as a read receipt was dropped with it.Nothing downstream reads
watermark. The webhook handler queuescontactMarkAsReadfor any parsedreadobject, and the worker'sparseReadTimestamptakes the time from the messaging event'stimestamp, so no handler change is needed.Validation
integrations/instagram-facebook/__tests__/webhook-integration-type.test.ts: a batch with a read receipt that has onlymid, followed by a text message. It checks that the payload parses and that bothcontactMarkAsReadandincomingMessageare queued. Without the schema change it fails with theinvalid_typeissue atentry.0.messaging.0.read.watermark.pnpm --filter @chatbotx.io/integration-instagram-facebook test: 31 files, 135 tests passedpnpm --filter @chatbotx.io/integration-instagram-facebook check-types: passespnpm lint: passesbuilder/workerfrom the pre-commit hook, and a live Meta webhook.