amazon-connect / amazon-connect-chat-interface

Amazon Connect Chat Interface - a browser-based customer chat widget for your website integrating with Amazon Connect ChatJS
https://docs.aws.amazon.com/connect/latest/adminguide/what-is-amazon-connect.html
MIT No Attribution
36 stars 39 forks source link

Receiving attachment files #30

Closed ebony-g closed 1 year ago

ebony-g commented 3 years ago

Hi,

May I know if there's an event to call when the chat receives an attachment file? Seems like cannot find it.

Regards, Ebony

swiszm-amazon commented 3 years ago

Received attachments are included in onMessage handler along with regular text messages.

If you are trying to add custom behavior when receiving an attachment, you can look at this example for adding audio notifications https://github.com/amazon-connect/amazon-connect-chat-interface#audio-notifications

For attachments, it would look something like:

this.session.onMessage(event => {
  const { chatDetails, data } = event;
  if (data.Type === "ATTACHMENT") {
    // do something
  }
});