Running into a weird sync issue with the Guest API on a custom web messaging channel. We’re bypassing the standard Messenger widget to build a lightweight chat UI embedded in a third-party app. The initial connection to the WebSocket works fine, and I can see the session token being generated correctly via the /api/v2/messaging/contacts endpoint.
The problem hits when the user sends a message. I’m posting to /api/v2/messaging/contacts/{contactId}/messages with a standard payload. The first message goes through, status 201. But subsequent messages from the same session start returning 409 Conflict. The error body says Message ordering violation or something similar about sequence numbers.
Here’s the payload I’m sending:
{
"type": "user",
"contentType": "text/plain",
"content": "Testing message two",
"sequenceNumber": 2
}
I’m incrementing the sequenceNumber manually on the client side because I thought the API needed it for ordering. Turns out that might be the culprit. The docs are a bit vague on whether the client should manage this counter or if the platform assigns it. I tried removing the sequenceNumber field entirely, but then I get a 400 Bad Request saying the field is required for this channel type.
Also checked the retry logic in my fetch wrapper. It’s exponential backoff, standard stuff. But the 409 isn’t a transient error, it’s a hard conflict. I’ve verified the contactId matches the session. The WebSocket is still open and receiving server-to-client messages, so the connection itself isn’t dropping.
Has anyone dealt with this sequence number mismatch? Is there a specific header I’m missing, or do I need to fetch the current sequence state from the platform before sending? The standard widget handles this silently, so I’m guessing it’s fetching the next valid sequence ID from a hidden endpoint.
Checked the EventBridge logs for the channel. Nothing shows up for the failed messages, so they aren’t even hitting the queue. Just bouncing off the API gateway.