Open bradley3322 opened 2 weeks ago
The error message signifies that shouldSendMessageReceipts flag is not set to true when sendEvent
API is called.
It seems sendEvent is called before enabling the flag using setGlobalConfig.
The error is thrown here https://github.com/amazon-connect/amazon-connect-chatjs/blob/ea40a33a658eebedbeecbbda622ddf1b805e096d/src/core/chatController.js#L158
Based on your comments, seems like the future events are working. So, we just need to make sure the config is updated before calling sendEvent.
I tested using https://github.com/amazon-connect/amazon-connect-chat-interface
and I was not able to reproduce the error.
Can you pls share minimum sample app to reproduce the issue.
Hi,
Thank you for your attention to this matter. While I am unable to provide a minimum sample app due to certain constraints, I can share the implementation details of our current solution.
We are using the connect.ChatSession.setGlobalConfig method to configure our chat session. This includes enabling message receipts and setting a throttle time. Below is the code snippet:
connect.ChatSession.setGlobalConfig({
features: {
messageReceipts: {
shouldSendMessageReceipts: true, // DEFAULT: true, set to false to disable Read/Delivered receipts
throttleTime: 500
}
}
});
After setting the global configuration, we create the chat session using ChatSession.create before starting the connection. Here is the implementation:
const customerChatSession = connect.ChatSession.create({
chatDetails: cnn.getMediaInfo(),
options: {
region: 'us-east-1',
},
type: connect.ChatSession.SessionTypes.AGENT,
websocketManager: connect.core.getWebSocketManager()
});
const {connectSuccess} = await startConnection(agentChatSession, contact?.contactId);
The sendEvent method is called only after the agent sends a message. By this point, the connection and session have been established and the configuration is in place. The code for sending events is as follows:
const response = await chatSession.sendEvent({
contentType: "application/vnd.amazonaws.connect.event.delivered",
content: JSON.stringify({messageId: data.Id}) // messageId from the send message response
});
Please refer to the attached screenshot for the console log showing each event step by step.
If you need further details or have additional questions, please let me know.
Thank you
Hi @bradley3322
From logs it seems like the issue is happening in Agent UI using ConnectStreams SDK with ChatJS SDK.
I am confused, because you mentioned you are building customer UI application using ChatJS
?
Also, I see multiple instances of log INFO ["new features added, initialValue: , newValue: MESSAGE_RECEIPTS_ENABLED",true]
, seems like there are multiple instances of the SDK in the same browser. Ideally, we should see this message only once .
QQ. Why do you have multiple SDKs initialized ? I see logs from minimized version of Streams SDK, non-minified version of Streams SDK, ChatsessionHandler logs ?
Pls note than GlobalConfig
is a singleton in your browser https://github.com/amazon-connect/amazon-connect-chatjs/blob/9b0147fd696a8c40952dcc8e38a1e613da406227/src/globalConfig.js#L4 but from logs it does not seem like a singleton, If you can not share sample application. Best path forward is if you can add a debugger here and ensure its not initialized multiple times and acts as a singleton.
I apologize for any confusion. In my previous message, I referred to it as a ‘customer UI,’ but I meant "representative UI"
I will respond to the questions asked after conducting a review. Thank you for your understanding and patience
Description:
We are developing a customer UI application utilizing Amazon Connect ChatJS. While implementing message receipts, we encountered an issue when using chatSession.setGlobalConfig to lower the throttle time.
Steps to Reproduce:
Expected Behavior:
Observed Behavior:
Code Example:
React typescript
chatSession.setGlobalConfig({ features: { messageReceipts: { shouldSendMessageReceipts: true, throttleTime: 1000 } } });
Additional Context: Amazon Connect ChatJS version: [2.2.4] We have also tested with the shouldSendMessageReceipts field removed to allow it to be set to the default but this results in the same behaviour