Deivid.Araujo | 2021-02-18 14:14:40 UTC | #1
Hello everyone, hope you're doing well.
Is there a way for me to get the count of interactions per ANI? For example, a number 5511982746172 called 36 times this month.
Thanks in advance
Deivid Araujo
Jerome.Saint-Marc | 2021-02-18 15:18:53 UTC | #2
Helo Deivid,
Yes, you can :-)
You could use an Analytics Query for conversation details - POST /api/v2/analytics/conversations/details/query to achieve this.
See here for some more information on the Conversation Detail query.
Essentially, you can send a query to retrieve conversation details, specifying a set of filters. The filters can be based on metrics or dimensions - here for a list of what's available. If you want to explore the filters possibilities, you can have a look at the Analytics Query Builder in the Developer tools
The Query for conversation details also needs to have an interval set - when there is a filter set, the interval window can be up to 31 days (floating). So that should fit your need.
When building the request, you must also set the max number of conversations that will be retrieved in a single page (pageSize attribute - max 100). If your query retrieves 100 conversations, you can then send the query again, specifying a different pageNumber (=2) to see if there are more conversations to retrieve. But I think 100 should probably be enough for your need (as I have set it below).
Regarding the filter on ANI, you might need to check at least one conversation in your Genesys Cloud org. [I mean doing a GET /api/v2/analytics/conversations/{conversationId}/details - to get a specific conversation by id] I think it should have an e.164 format (+country-code and number). That's the case in my Genesys Cloud environment. There is also a "tel:" prefix in mine. I just don't know if it is the same in all orgs (as this may vary depending on your voice/trunk configuration).
Here is the request I tried. Interval length is one month. I have set a max of 100 records/conversations per page (and retrieving pageNumber 1). I have set to segmentFilters - one to specify voice interaction, and one for the ANI (again, check if you need the tel: in front and if you need e.164 format for the number).
{ "interval": "2021-01-18T23:00:00.000Z/2021-02-18T23:00:00.000Z", "order": "asc", "orderBy": "conversationStart", "paging": { "pageSize": 100, "pageNumber": 1 }, "segmentFilters": [ { "type": "and", "predicates": [ { "type": "dimension", "dimension": "mediaType", "operator": "matches", "value": "voice" }, { "type": "dimension", "dimension": "ani", "operator": "matches", "value": "tel:+33123456789" } ] } ] }
If there are no conversations matching the number, the response body will just be: {}
If there are conversations, you will have a conversations attribute being an array of conversations - so you can check the length of the conversations array to know how many times you got a call with this ANI in the past month.
{ conversations: [ { ... }, { ... } ] }
Regards,
system | 2021-03-21 15:18:56 UTC | #3
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 10028