Olá Diana,
Para reproduzir o mesmo comportamento no aplicativo (ex.: Pega + Embeddable Framework), é necessário calcular o tempo desde a última mensagem no front-end:
1. Obter os detalhes da conversa:
GET /api/v2/conversations/{conversationId}
2. Identificar o timestamp da última mensagem enviada ou recebida (`messages[]`).
3. Calcular o tempo decorrido no seu front-end com base no horário atual:
- Ex.: `Date.now() - new Date(lastMessage.timestamp)`
4. Atualizar o timer na interface conforme desejado.
Se preferir atualização em tempo real, é possível utilizar notificações da conversa:
https://developer.genesys.cloud/devapps/notifications/conversations
Essa abordagem reproduz exatamente a lógica utilizada pelo Genesys UI.
Espero que ajude!
Hi Diana,
To display the same timer behavior in your custom application:
1. Retrieve the conversation details:
GET /api/v2/conversations/{conversationId}
2. Identify the timestamp of the last message (agent or customer).
3. Calculate the elapsed time in your front-end based on the current time and update the timer accordingly.
If you require real-time updates (e.g., when a new message arrives), you can subscribe to Conversation notifications:
https://developer.genesys.cloud/devapps/notifications/conversations
This approach matches how the Genesys UI displays the timer.
Hope this helps!
------------------------------
Fernando Sotto dos Santos
Consultor Grupo Casas Bahia
------------------------------