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
91 stars 53 forks source link

Facing Issue when working with multimedia messages #187

Closed SaqibOctave closed 11 months ago

SaqibOctave commented 11 months ago

Hi, I am trying to get the Multimedia URL of S3, For that we use getAttachment API of amazon connect. I am using amazon-connect-chatjs, In these streams there is a method name downloadAttachment.This downloadAttachment method Wraps the GetAttachment API. I invoke this method to get the URL, What I Expect:

try{
                  const chatAttachmentResponse = await controller.downloadAttachment({
                    attachmentId: response.data.Attachments[0].AttachmentId,
                  })
                  console.log("chatAttachmentResponse :: ", chatAttachmentResponse);
                  const { attachment } = chatAttachmentResponse.data;

                  console.log("atachment Response :: ", attachment);
                }catch(e){
                  console.log(e)

When it hit this method I expect The response like Response. What I got: When above method hit it return a Blob and starts downloading the file directly.

mliao95 commented 11 months ago

Hi @SaqibOctave!

The functionality of downloadAttachment is to call the ACPS (Amazon Connect Participant Service) GetAttachment API to get the URL and automatically download it. The methods in amazon-connect-chatjs leverage ACPS APIs but are not direct mirrors.

If your use case requires the direct use of ACPS APIs, you would have to call that directly: https://docs.aws.amazon.com/connect-participant/latest/APIReference/working-with-acps-api.html

Let me know if you have any other questions!

SaqibOctave commented 11 months ago

@mliao95 i tried to run the sendAttachment method of amazon-connect-chatjs but there is a problem with that image the first API is called successfully but when it go to call complete-attachment-api it gives an error like image would you please help me that how to run these API directly in an angular project?

SaqibOctave commented 11 months ago

I have Used get Attachment API in angular but didn't know how to use in angular Please share if you have any Idea.