Trying to understand why POST /api/v2/conversations/messaging/contacts/{contactId}/messages rejects my card payload. The docs say content accepts JSON, but I get a 400 when sending nested objects directly.
{ "type": "card", "title": "Status", "content": { "status": "ok" } }
Should I stringify the inner content before posting, or is the API expecting a flat key-value pair for quick replies?
Make sure you serialize the entire payload correctly. The endpoint expects a standard JSON object, not nested serialization artifacts. Use the TypeScript SDK’s CreateConversationMessageRequest model to handle type safety automatically. See this guide: https://support.genesys.com/s/article/om-serialization-tips.
const req = new PureCloudPlatformClientV2.CreateConversationMessageRequest({
content: JSON.stringify({ type: "card", title: "Status" }),
contentType: "application/json"
});
await platformClient.ConversationsApi.postConversationContactMessage(contactId, req);