amazon-connect / amazon-connect-chatjs

Amazon Connect ChatJS - a browser-based contact center integration API for Chat on the Agent and Customer side.
https://docs.aws.amazon.com/connect/latest/adminguide/what-is-amazon-connect.html
Apache License 2.0
93 stars 54 forks source link

Download Attachment Returning Blob istead of S3 pre-signed URL #201

Closed OctaveIdeas closed 9 months ago

OctaveIdeas commented 10 months ago

I am using connect stream with angular i have setup the custom CCP for Chat widget. plain messages are working perfectly fine. but when i sent Media message through streams it returns an attachment ID, I invoke the downland attachment api and pass the attachment Id as a parameter. What i expect: I expect in response it deliver the S3 URL, as mentioned in the Document. What i get: I get the blob in response of download attachment Api const chatAttachmentResponse = await controller.downloadAttachment({ attachmentId: response.data.Attachments[0].AttachmentId }); console.log("Download Attachment Responmse is :: ", chatAttachmentResponse); Response :

image

spenlep-amzn commented 9 months ago

Hi @OctaveIdeas,

ChatJS is working as expected. ChatJS is a wrapper around the JavaScript AWS SDK, so it contains additional logic. The actual GetAttachment API will return the S3 url.

downloadAttachment() will return the actual file as mention in the README doc. It will get the url AND download, please refer to this code block: [ref]

Going to resolve this issue now. Please feel free to open further issues or comment if documentation is unclear Thank you, -Spencer