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

Events to listen to ? #26

Closed bjm88 closed 1 year ago

bjm88 commented 3 years ago

Hi - since this code seems to be the default chat UI, is there a way to listen to published events?? Like on agent side in CCPv2 we have:

window.connect.contact(function (contact) { contact.onConnecting(async function (contact) { console.log("Contact connecting " + JSON.stringify(contact))

Is there a way to have this for this code as well? Want a simple way to hook-in to get notified of a contactId when consumer first starts.......

ideally also pass in customized attributes that would be available in the AWS Connect contact flow. Anyway to do these things without totally forking and hosting this code ourself?

johnmryan commented 3 years ago

Hey there @bjm88

  1. Events - As far as I know, the only global event we expose is https://github.com/amazon-connect/amazon-connect-chat-interface/blob/master/src/components/Chat/ChatInterface.js#L31 where you can listen for the attempt to initiate the chat. I will follow up with details if I find another way to do that currently.
  2. You can pass custom Attributes into the initiate chat call, they will be picked up here when we start the chat: https://github.com/amazon-connect/amazon-connect-chat-interface/blob/master/src/components/Chat/ChatInitiator.js#L43