jarlei | 2021-04-01 15:32:20 UTC | #1
Hi Folks!
I'm new here so I'm sorry that my question is silly.
I need to get the conversationID of the last conversation from an external contact who had his conversation answered by an agent.
I'm using the API:
POST
/api/v2/analytics/conversations/details/query
Body:
{ "interval": "2021-03-25T03:00:00.000Z/2021-03-26T03:00:00.000Z", "order": "asc", "orderBy": "conversationStart", "paging": { "pageSize": 25, "pageNumber": 1 }, "segmentFilters": [ { "type": "and", "predicates": [ { "type": "dimension", "dimension": "mediaType", "operator": "matches", "value": "chat" }, { "type": "dimension", "dimension": "externalContactId", "operator": "matches", "value": "c5c88265-922e-441b-9f76-c393b6fc3ca6" } ] } ] }
it works but it returns all conversations for a period, is there a filter to return only the last one?
greetings and thanks in advance.
Jerome.Saint-Marc | 2021-04-06 12:49:53 UTC | #2
Hello,
There is no "filter" to return just one conversation. But you can leverage the "order" parameter and the "pageSize" parameter in your request to achieve this.
I would set order to "desc" (so that the returned conversations are ordered from most recent to oldest conversation). And I would set pageSize to 1 (so that only one conversation is returned per page). With order=desc and pageSize=1, you would retrieve the most recent (last) conversation with this contact in your first page (i.e. pageNumber = 1).
Regards,
jarlei | 2021-04-06 14:16:52 UTC | #3
Thanks @Jerome.Saint-Marc 🦾
it's work for me!!! 😎
system | 2021-05-06 14:16:56 UTC | #4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 10479