Closed OctaveIdeas closed 9 months ago
@spencerlepine please check this
Hi @OctaveIdeas,
No, there is no way to "add my additional information with a send attachment and get this information on the WebSocket onMessage event"
with just ChatJS.
You can return metadata
with the promise, but that data stays client-side (not being sent end-to-end):
// https://github.com/amazon-connect/amazon-connect-chatjs?tab=readme-ov-file#amazon-connect-participant-service-api-wrappers
function handleResponse(response) {
const { data, metadata } = response;
// ...
}
function handleError(response) {
const { error, metadata } = response;
// ...
}
await chatSession
.sendAttachment({ attachment: file, metadata: "foo" })
.then(handleResponse, handleError);
Please confirm if there is a bug with ChatJS, or this is just a question about how to add feature to your own implementation.
With the information provided about your setup, it is not clear what the expected end-to-end flow is
@spenlep-amzn this is just a question to add feature in my implementation
Closing this issue due to inactivity.
Please feel-free to re-open if you have additional info about the setup.
Thanks -Spencer
Success Case: I am using amazon-connect-chatjs sendAttachment method to send attachments . It is working fine.
I have to send some additional information with a file to my backend, which I wrote using Amazon Connect Chat APIs. I have different types of channels (whatsapp) communicating with my frontend using that backend. I have to make a decision on the additional information to whom I have to send the attachment. Is there any way to add my additional information with a send attachment and get this information on the WebSocket onMessage event? Please guide me on how I can achieve that approach.
i want something like this:
await controller.sendAttachment({ attachment: file}, {additional information}) or await controller.sendAttachment({ attachment: file, additional information})
I've tried the above approach but got same attachment response on WebSocket as previous, all the information got ignored or removed.