Retention of conversation APIs

How much older conversations can be pulled through APIs? We are not able to retrieve messages for conversations through endpoints or API Explorer tool for conversations older than 7-10 days. Can we change the time period for a division? If yes, how?

Conversations can be queried for up to 60 days: https://developer.genesys.cloud/api/rest/v2/conversations/overview#request-a-conversation

Can you let us know which API you are calling - as well as the request body and what error you are receiving?

Hi Becky,

Thanks a lot for your response.
I am querying /api/v2/analytics/conversations/{conversationId}/details for interaction 3c8ee40e-8fd5-4e74-a21c-e3fd61d226ac

Getting below error:
{
"message": "Invalid login credentials.",
"code": "bad.credentials",
"status": 401,
"contextId": "e09e02bf-13e0-41ce-8b91-3eaec4ab2126",
"details": [],
"errors": []
}

It is an interaction that was created 10 days ago.

Thanks,
Somik Mukherjee

If the conversation was no longer available, you would receive a 404 error - not a 401 error. The error you are receiving has nothing to do with the conversation itself, but rather that you have failed to auth in properly.

For what its worth, when this happens to me I can typically resolve by logging out and back in to Genesys Cloud and the Dev Tools.

I hope this helps!

2 Likes

Hi Becky,

Thank you for the workaround of re-logging in. It helped.
One doubt I wanted to clarify still, I tried to query an interaction older than 60 days but it returned results (719e99be-b559-459d-b79f-1303613287be):

"conversationEnd": "2021-08-27T12:28:22.693Z",
"conversationId": "719e99be-b559-459d-b79f-1303613287be",
"conversationStart": "2021-08-27T12:27:43.615Z",
"divisionIds": [
"d6b15a05-eaf9-4b9f-a732-3b6d1f6a2fde"
],
You mentioned earlier that conversation can be queried for the past 60 days. Can you please check the setting for this org/division? Also, is it possible to change the retention of this? For example, if we want to increase it to 90 days -180 days will it be possible?

Thanks,
Somik Mukherjee

Somik - you are using the analytics/conversation/details endpoint which has a TTL of 558 days. If you queried conversation service directly (not using one of the analytics endpoints), the TTL would be 60 days!

Hope that helps.

Thanks Chris.

We are using following apis to pull the metadata and messages are

Conversion Metadata - /api/v2/conversations/chats/:conversationId
Conversion Message - /api/v2/conversations/chats/:conversationId/messages

Moreover, we are using following api to fetch all the conversations between an interval

All Conversation IDs - /api/v2/analytics/conversations/aggregates/query

An empty list is returned for the interval « 2021-08-26T13:00:00.000Z/2021-08-28T23:00:00.000Z »

Other than the above api, do you use or are aware of any api that can pull the list of conversationIds relevant to the configured chat/bot flows for an interval?

Thanks,
Somik Mukherjee

OK - so we're mixing up APIs a bit here - but I don't think you are far off!

The /api/v2/conversations/chats/... will provide you data only for 60 days as that is the limit of conversation data in our main conversations API. Where as the /api/v2/analytics/conversations/aggregates/query is our analytics aggregate query and that holds data for 5 years.

Before I can answer your question about 'any API that can pull the list of conversationIDs - I need to know what data you are looking for. Typically, we point customers to our analytics/conversations details endpoint which stores data for 558-days. But it doesn't contain custom attributes, so if that is needed we'll push customers to the analytics/conversations/jobs endpoint (which makes data available next day).

Can you shed a little more light on your use case?

As for the API returning a empty list for that 2 day span - my recommendation would be to have Care take a look. If you have the correlationID - that would be good to provide with the case.

Thanks,
Chris

Hi Chris,

Below are the two queries we are looking for:

  1. How can we distinguish the owner of the message in the response from api
    /api/v2/conversations/chats/2b307ab1-bcdb-4e64-ace4-5f8209b20564/messages
    The response provides both user utterances and bot responses with bodyType as standard and text within body field

          For reference:
                        {
                                                  "id": "a86a51dc-5987-486d-9970-3d7febea1b64",
                                                  "conversation": {
                                                                    "id": "2b307ab1-bcdb-4e64-ace4-5f8209b20564",
                                                                    "selfUri": "/api/v2/conversations/2b307ab1-bcdb-4e64-ace4-5f8209b20564"
                                                  },
                                                  "sender": {
                                                                    "id": "bda8416a-ffc1-4bc2-ac7b-e6e46415bf87"
                                                  },
                                                  "body": "Am I chatting with John Miles?",
                                                  "bodyType": "standard",
                                                  "timestamp": "2021-10-23T18:41:04.650Z",
                                                  "selfUri": "/api/v2/conversations/chats/2b307ab1-bcdb-4e64-ace4-5f8209b20564/messages/a86a51dc-5987-486d-9970-3d7febea1b64"
                                }, {
                                                  "id": "301ed9b7-af27-458c-854c-739b20583da0",
                                                  "conversation": {
                                                                    "id": "2b307ab1-bcdb-4e64-ace4-5f8209b20564",
                                                                    "selfUri": "/api/v2/conversations/2b307ab1-bcdb-4e64-ace4-5f8209b20564"
                                                  },
                                                  "sender": {
                                                                    "id": "a49a7b10-a9c3-4785-b05d-6964cc84a556"
                                                  },
                                                  "body": "YES",
                                                  "bodyType": "standard",
                                                  "timestamp": "2021-10-23T18:41:08.107Z",
                                                  "selfUri": "/api/v2/conversations/chats/2b307ab1-bcdb-4e64-ace4-5f8209b20564/messages/301ed9b7-af27-458c-854c-739b20583da0"
                                }
    

Thanks,
Somik Mukherjee

Somik - I'm a little out of my depths here simply because I don't know the conversation flow for chats. Let me see if I can follow-up with our dev team and get you answer!

Stay tuned!

Hello,

You can correlate the owners of messages you get in the response from the GET /api/v2/conversations/chats/{conversationId}/messages with the conversation's participants, using the sender.id attribute value, available on each message.

Retrieve the conversation context with GET /api/v2/conversations/{conversationId} or the conversation details (Analytics) with GET /api/v2/analytics/conversations/{conversationId}/details

The sender.id value of the message can be found:

  • In a Conversation Context: the "id" attribute of the chat for the corresponding participant (in the participant structure, "id" of the chat structure/session, in the "chats" array attribute)
  • In Conversation Details: the "sessionId" attribute of the session (chat) for the corresponding participant (in the participant structure, "sessionId" of the chat session, in the "sessions" array attribute)

Regards,

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.