400 Bad Request when posting canned response via Conversations API in mobile app

Trying to understand why my mobile app receives a 400 Bad Request when attempting to send a canned response during an active Web Messaging session using the Genesys Cloud Conversations API.

Context:
I am developing a custom iOS client using the Genesys Cloud Web Messaging SDK (v2.1.4). The app successfully initiates chats and handles real-time text messages. However, when an agent selects a canned response from their desktop UI, my mobile app needs to mirror this action or handle the incoming system message correctly. I am trying to programmatically inject a canned response into the conversation thread via the REST API to test synchronization, but the server rejects the payload.

I am using the POST /api/v2/conversations/messaging/{conversationId}/messages endpoint. My authorization header contains a valid OAuth token with the messaging:write scope. The conversation ID is retrieved directly from the SDK’s session object. Here is the cURL equivalent and the JSON payload I am sending:

{
 "to": {
 "id": "agent-user-id-123",
 "type": "user"
 },
 "from": {
 "id": "mobile-app-client-id",
 "type": "user"
 },
 "body": {
 "contentType": "text/plain",
 "content": "Thank you for contacting support. Your ticket number is #12345."
 },
 "metadata": {
 "source": "canned-response",
 "cannedId": "canned-uuid-456"
 }
}

Question:
The response body returns:

{
 "code": "badRequest",
 "message": "Invalid message format: 'to' field must match the conversation's other participant or be a valid routing queue.",
 "status": 400
}

I have verified that the to.id is the correct agent user ID associated with the conversation. Is there a specific requirement for the to field when sending messages via the Conversations API in a Web Messaging context? Or should I be using a different endpoint, such as the Interaction Control API, to properly trigger a canned response injection? I am on the America/Sao_Paulo timezone and using the US East region.

This looks like a scope mismatch rather than a payload issue. The conversations:write scope is mandatory for canned responses, and mobile tokens often default to read-only. Verify the token using curl -H "Authorization: Bearer <token>" https://api.mypurecloud.com/api/v2/oauth/userinfo and ensure conversations:write is present.