Attachments Not Rendering in Inbound Messages Using Genesys JavaScript SDK

Hello Genesys Community,

I'm experiencing an issue with rendering attachments in inbound messages using the Genesys OM platform. Despite receiving a successful response from the API, the attachments do not appear in the conversation view.

Implementation Details:

Payload Structure:

const body = {
  channel: {
    messageId: uuid.v4(),
    from: {
      nickname,
      id: userId,
      idType: "Opaque",
      firstName,
      lastName,
    },
    time: String(timestamp || new Date().toISOString()),
    metadata: { customAttributes },
  },
  text: message || "",
  content: [
    {
      attachment: {
        mediaType: "Image",
        url: "https://www.genesys.com/media/4a30f651-ba-genesys-logo-color.png",
        mime: "image/png",
        filename: "4a30f651-ba-genesys-logo-color.png",
        text: "Genesys Logo",
      },
    },
  ],
};

Request and Logging:

const conversationAPI = new platformClient.ConversationsApi();
const messageResult = await conversationAPI.postConversationsMessageInboundOpenMessage(
  integrationId,
  body,
);
console.log("messageResult", messageResult);
console.log("messageResult.content", messageResult.content);

Success Response Received:

{
  "id": "6558e4292080fda6a90026a6f3ddb02a",
  "channel": {
    "id": "05a05554-c8c5-40e7-86d7-4693591f845a",
    "platform": "Open",
    "type": "Private",
    "messageId": "c979dd99-b35a-4214-8dee-9c11106fa6d0",
    "to": { "id": "05a05554-c8c5-40e7-86d7-4693591f845a" },
    "from": {
      "nickname": "f83c16dd-c736-4cb5-aa55-53a2ceaf1427 ",
      "id": "f83c16dd-c736-4cb5-aa55-53a2ceaf1427",
      "idType": "Opaque",
      "firstName": "f83c16dd-c736-4cb5-aa55-53a2ceaf1427",
      "lastName": ""
    },
    "time": "2024-10-01T08:43:43.080Z",
    "metadata": { "customAttributes": [Object] }
  },
  "type": "Text",
  "text": "hello",
  "content": [
    {
      "contentType": "Attachment",
      "attachment": {
        "mediaType": "Image",
        "url": "https://www.genesys.com/media/4a30f651-ba-genesys-logo-color.png",
        "mime": "image/png",
        "text": "Genesys Logo",
        "filename": "4a30f651-ba-genesys-logo-color.png"
      }
    }
  ]
}

Issue:

  • After sending the message, the console logs confirm a successful response with the attachment details.
  • However, the attachment does not render in the Genesys OM conversation interface.

What I've Tried:

  • Verified that the attachment URL (https://www.genesys.com/media/4a30f651-ba-genesys-logo-color.png) is accessible and points to a valid image.
  • Ensured all required fields in the payload are correctly populated.
  • Checked for any discrepancies in the mediaType and mime fields.
  • Confirmed that the API response indicates successful message processing.

Questions:

  1. Additional Configuration: Is there an additional configuration required to render attachments in inbound messages on the Genesys OM platform?
  2. Attachment Limitations: Are there any known limitations or specific formats for attachments that I should be aware of?
  3. Troubleshooting Steps: Can anyone provide insights or suggest troubleshooting steps to resolve this rendering issue?

Additional Information:

  • Request Method: POST
  • Endpoint Used: As described in the Genesys Inbound Text Messages documentation.
  • Logging: Implemented console logs to capture both the entire response and the content array specifically.

Any assistance or guidance would be greatly appreciated. Thank you!

Hi @Cesar It's not clear to me if all messages are not rendering for you, or just attachments? But for starters I would suggest following this page gettingConversationId to first find the conversationId your message(s) are associated with. Then you can follow this page messaging-apis to GET the conversation and figure out where that message is and the information associated with it. Did it have any errors on the media for instance?
I would also check your SupportedContent allows that media type Supported content profiles - Genesys Cloud Resource Center.

One more thing. you should be also receiving a receipt for that message on your open messaging integration webhook. See inbound-receipts That should provide you some information if the message failed after it was initially accepted from your POST request.

Hi Greg, thank you for the quick answer.

It happens to me only when I add the content property with an attachment, even sending the payload I posted earlier, but missing the "mediaType" or "mime" will throw me an error as expected, and sending the payload without attachment, like this

const body = {
  channel: {
    messageId: uuid.v4(),
    from: {
      nickname,
      id: userId,
      idType: "Opaque",
      firstName,
      lastName,
    },
    time: String(timestamp || new Date().toISOString()),
    metadata: { customAttributes },
  },
  text: message || ""
};

Then it works perfectly and the message is rendered in Genesys, as a normal text message should.

But the complete payload i putearlier sends back the success message but renders nothing

I will give it a check to the suggestions you did, thanks.

Gotcha, yeah that means it failing after the initial checks of your payload on your POST request, but before it gets to the Conversation. So looking at the webhook receipt that is sent back to you, should help you figure out why it's failing on that media.

Hi Greg, thanks for the answer, where do i exactly get the receipts?
The only response Im getting is like the one in this example

{
  "id": "6558e4292080fda6a90026a6f3ddb02a",
  "channel": {
    "id": "05a05554-c8c5-40e7-86d7-4693591f845a",
    "platform": "Open",
    "type": "Private",
    "messageId": "c979dd99-b35a-4214-8dee-9c11106fa6d0",
    "to": { "id": "05a05554-c8c5-40e7-86d7-4693591f845a" },
    "from": {
      "nickname": "f83c16dd-c736-4cb5-aa55-53a2ceaf1427 ",
      "id": "f83c16dd-c736-4cb5-aa55-53a2ceaf1427",
      "idType": "Opaque",
      "firstName": "f83c16dd-c736-4cb5-aa55-53a2ceaf1427",
      "lastName": ""
    },
    "time": "2024-10-01T08:43:43.080Z",
    "metadata": { "customAttributes": [Object] }
  },
  "type": "Text",
  "text": "hello",
  "content": [
    {
      "contentType": "Attachment",
      "attachment": {
        "mediaType": "Image",
        "url": "https://www.genesys.com/media/4a30f651-ba-genesys-logo-color.png",
        "mime": "image/png",
        "text": "Genesys Logo",
        "filename": "4a30f651-ba-genesys-logo-color.png"
      }
    }
  ]
}

But this looks differente thatn the one expected as shown in the documentation Message receipts (genesys.cloud)
The ones im getting say type="text" like the message, instead of type="receipt"

please note that i am logging the result of the response from the platformClient

const conversationAPI = new platformClient.ConversationsApi();
const messageResult = await conversationAPI.postConversationsMessageInboundOpenMessage(
  integrationId,
  body,
);

Is there something I need to adjust in Genesys or log any other response?

The receipt is going to come on the open messaging integration webhook you setup when you created your open messaging integration (your integrationId there in your sample code). You will receive a POST request to that webhook (outboundNotificationWebhookUrl field on the integration get-api-v2-conversations-messaging-integrations-open--integrationId-), that has a "type": "Receipt", with some more information. This will come from every inbound message you call conversationAPI.postConversationsMessageInboundOpenMessage for.

Thank you, I was able to debug the issue, it looks like the url of the image in the example is not reachable. I tested it with other url and it worked, thanks for the help

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.