Repository navigation
Description
Summary
Contacts that originate from a Facebook comment cannot be messaged through the public API — even after the contact replies to the private reply and a standard 24-hour messaging window is open. The send returns 204, a message row is created, and nothing is delivered. sourceId is never populated on the row, which is the only way to tell from outside that it failed.
Sends to non-comment-origin contacts on the same inbox work reliably (22/22 in our sample), so this is specific to comment-originated contacts.
Cloud (app.chatbotx.io), Messenger channel, workspace API key.
Reproduction
Contact A (11630996004388864), inbox 11627001976487936. Times UTC, same thread:
| time | messageType | senderType | delivered? | note |
|---|---|---|---|---|
| 10:47:30 | outgoing | user |
yes (sourceId set) |
sent from Meta Business Suite, echoed in |
| 10:47:50 | incoming | contact |
yes | contact replies — 24h window opens |
| 10:47:59 | outgoing | api |
no (sourceId null) |
POST /v1/contacts/id:.../messages → 204 |
Contact B (11630484688945152) is identical: contact sends "Is this free?" at 01:48:02, our API reply at 01:48:11 never delivers.
Sending manually from the ChatbotX inbox UI on the message thread also fails to deliver, so this is not specific to the public API.
Both contacts have a normal 17-digit contactInbox.sourceId, the same shape as contacts we message successfully. Their conversation.sourceId is <pageId>_<postId>.
Expected
Per Meta's Private Replies docs:
Only when a person responds to the private message can you continue the conversation within the 24-hour messaging window.
The contact responded, so a normal send should succeed.
Suspected cause
apps/worker/src/integration/handlers/received-message.ts — receiveComment keys the conversation to the post:
const incomingContact: IncomingContact = {
sourceId: commentData.fromId,
sourceConversationId: commentData.postId,
}apps/worker/src/chat/handlers/send-message.ts then forwards that to the channel handler:
contact: { ...contactInbox, sourceConversationId: conversation.sourceId }So a send resolving the comment conversation hands the channel a post id where a working contact supplies a message thread id. (The messenger channel implementation isn't in this repo, so I couldn't verify past this point.)
Possibly compounded by the assumption on the line above it:
// `from.id` is the commenter's ID (PSID for Messenger, ...)Meta treats IDs across surfaces as not interchangeable — hence the ID Matching API. If a comment's from.id is not the messaging PSID for that Page, storing it as contactInbox.sourceId would produce exactly this: a well-formed id the Send API rejects.
Secondary issue: the failure is invisible to API consumers
send-message.ts emits message:failed internally, but nothing is persisted on the message row and the public API exposes no delivery status. From outside, a dead message is indistinguishable from a delivered one except by inferring from sourceId: null. This is the same silent-failure shape described in #831.
Surfacing a delivery status on the message resource would let integrators detect this without guesswork.
Third issue: lastIncomingMessageAt ignores comments and attachment-only messages
received-message.ts:
if (incomingMessage.messageType !== "outgoing" &&
(incomingMessage.type ?? "message") === "message") {
tracking.lastIncomingMessageAt = message.createdAtComments never update it, and attachment-only messages appear not to either. Since the unreplied and lastInteractionMinutesAgo contact filters are built on that column, any integrator polling for "who is waiting on a reply" is blind to both. In our workspace 48/50 comment-origin contacts have lastIncomingMessageAt: null.
Impact
Comment-to-DM is our main lead source. Every one of those leads who engages gets a reply that is recorded, billed, and shown as sent — and never arrives. It is silent on every surface except the Facebook thread itself.
Happy to test any fix against a live workspace.
Activity
auroradream04 commentedon Jul 31, 2026
Correction: this is not limited to comment-originated contacts
I scoped this to comment-origin contacts. That was wrong — it happens to contacts who messaged the Page directly too.
Contact
11630857076490240,contactInbox.source = inboundMessage,conversation.sourceId = null(no post anchor anywhere):She messaged the Page directly, we replied 10 seconds later, and it was never delivered.
Measured failure rate
Unbiased sample — every thread with an API-sent message in the last 24 hours, no filter on what happened afterwards:
senderType: apisourceIdnever populated → 13.1%My earlier "22/22 succeed" figure in the issue was measured on threads where the contact replied afterwards, which self-selects for delivered messages. Please disregard it.
What this means
Roughly one in eight API sends is silently dropped, across both comment-origin and direct-message contacts. Because
message:failedis emitted internally but never persisted on the row or exposed on the API, integrators have no way to detect it other than pollingsourceIdand inferring — which is what we now do.That makes the second point in the original issue (surface a delivery status on the message resource) considerably more urgent than the first: even if the root cause is environment-specific, an integrator currently cannot tell a delivered message from a dropped one.
Happy to run any diagnostic against this workspace.
sung17 commentedon Sep 23, 2026
Thank you for this report — and particularly for the follow-up correction.
Retracting the "22/22 succeed" figure because it was measured on a
self-selecting sample, and replacing it with an unbiased 24-hour one, is more
rigour than a bug report usually gets. It changed how we prioritised this.
Your second point already shipped
The silent-failure problem — a dropped message being indistinguishable from a
delivered one — was addressed in #946 (merged 13 Aug). It adds a
sendErrorcolumn to the message row, written by the worker when a channel send throws and
cleared again if a retry later succeeds. It is returned on the message resource,
so
contacts.listMessagesandcontacts.getMessageshould now carry it.Could you confirm it is present on your instance? If it is, each of those 11
dead rows should carry the actual Graph API error — by far the most useful
thing for closing the rest of this.
Your suspected cause is not it
You read the code correctly:
receiveCommentdoes key the comment conversationto the post, and the chat handler does forward that as
sourceConversationId.But the Messenger handler never reads that field. It builds the Send API payload
as
recipient: { id: contact.sourceId }— the PSID fromContactInbox. A postid arriving there is simply ignored, so it cannot be what breaks the send.
Your ID Matching hypothesis is the stronger one and we have not ruled it out.
On
lastIncomingMessageAtHalf right. Comments genuinely do not update it. Attachment-only messages do —
the inbound check looks at message type, not at content.
The comment exclusion is deliberate, and for a reason worth knowing: that column
also feeds the Messenger messaging-window policy, not only the
unrepliedandlastInteractionMinutesAgofilters. If comments refreshed it, we would starttreating the 24-hour window as open when Meta does not — turning a silent
failure into a louder one. For "who is waiting on a reply, counting commenters",
the value you want is
lastCommentMessageAt, maintained separately on thecontact-inbox row. If that is not reachable from where you need it, say so and
we will treat that as its own gap.
What we have changed so far
#1248 makes the public contacts API resolve a contact's conversation and
ContactInboxdeterministically. Both were previously picked without anordering, so a send could land on a comment thread or address the wrong channel,
and it failed asynchronously after the handler had already returned 204 — the
same shape you describe.
We are deliberately not claiming that as the fix for this issue. It is a real
bug on its own merits, but whether it accounts for your 13% is unconfirmed,
which is why #1248 references this issue rather than closing it.
What would help most
sendErrorfor the rows wheresourceIdstayed null. One sample is enough.ContactInboxrows they have (how manychannels/pages), how many
Conversationrows, and whichconversationIdthedead message landed in — the DM conversation, or a comment thread.
contactInbox.lastIncomingMessageAtfor those contacts at the time of thesend.
(2) tells us whether #1248 was the cause. (3) tests a separate hypothesis: API
sends currently run through the same messaging-window policy as inbox sends,
which refuses outright past 7 days since the last inbound message. We would
rather see your data than loosen that on a guess.
Keeping this open until the numbers say otherwise.
fix(api): stop resolving a contact's conversation and inbox arbitrarily
fix(api): stop resolving a contact's conversation and inbox arbitrari…
fix(api): stop resolving a contact's conversation and inbox arbitrari…