Guest API 401 when trying to send messages without the widget

We’re trying to build a custom chat interface that bypasses the standard Genesys Cloud Messenger widget entirely. The goal is to use the Guest API endpoints directly so we can control the UI completely. I’ve been following the documentation for the Guest API, but I’m hitting a wall with authentication when trying to send the first message.

Here is the flow I’m attempting:

  1. Generate a guest token using POST /api/v2/conversations/messaging/external/guests.
  2. Use that token to establish a session.
  3. Send a message using POST /api/v2/conversations/messaging/external/guests/{guestId}/messages.

The token generation works fine. I get back a valid guestToken and guestId. But when I try to send the message, I get a 401 Unauthorized error. Here is the request body I’m sending:

{
 "externalChannelId": "my-channel-id",
 "body": "Hello world"
}

And the headers:

Authorization: Bearer <my_org_token>
X-Genesys-Client-Id: my-client-id

Wait, I think I see the issue. The Guest API endpoints require the guest token to be passed in the Authorization header as Bearer <guestToken>, not the org admin token. But I’m confused about how to pass the guest token if I’m making the request from a backend service that doesn’t have the guest context yet.

If I use the org token, I get 401. If I use the guest token, I get 403 Forbidden because the guest token doesn’t have permissions to call the external guest endpoint directly? Or am I missing a step where I need to bind the guest to a specific conversation first?

Here’s the error response I’m getting:

{
 "code": "unauthorized",
 "message": "The request requires user authentication."
}

I’m feeling a bit lost on the exact sequence of calls needed to get this working without the SDK handling it for me. Any examples of the exact header setup for the message send call would be appreciated.