I subscribed to topic v2.users.{id}.conversations.messages. I need to grab the customer messages. I can get the customer messages fine without agent sending any message. However, when the gent send a message, I am getting 3 notifications with 3 different messagestatus. How can I identify the notification is trigger by the customer?
Hi @Michael_Wong i'm not sure i fully understand your issue there. But if you take a look at the notification body, you will see eventBody.participants[].purpose
set to customer or agent and that will help you identify which participant each message is associated with. That notification topic gives you the whole Conversation each time, so you will have to do a little digging to separate things. Also if you review this page it might help you with some more context of messaging conversations messaging-apis
Hi Greg, Thanks a lot for your feedback. Actually what I need to do is to implement a customize "chat/messaging" client on the agent side. My plan is when the agent received a notification from that topic, I will look for the last message Id and get the textBody with another API and show on the chat client. However, when the agent sending messages, the agent also received notifications for their messages, and I can't tell whether the customer or the agent triggered the notification, I don't know when I should read the last message from the customer and now I am repeating the last message 3 times that the customer send when the agent reply to a message. Beside building a chronological ordered message list each time when I received a notifcation, is there any other way to handle this?
Thanks again.
The 3 times notification thing, is likely because that 1 agent message, has it's eventBody.participants[].messages[].messageStatus
change from queued
to sent
to delivery-success
. And that is normal transitions for outbound messages. So you are receiving notifications about ALL of those status changes, for a single message.
Again that topic you are subscribed to, is showing ALL changes on that Conversation, not even just messageStatus changes. So you are going to have to build logic in your code, to handle the deltas there, no matter.
Sorry i can't really help more there, but maybe others on this forum have implemented similar and have some open source libraries they've used that help them with it. Best of luck
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.