Reterive last call based on caller ID

Hi All,

Is there a way from within the IVR to check (or retrieve last call's data) when a particular client called based on this phone number?

Regards,

Hussein

You can write a data action to query the /api/v2/analytics/conversations/details/query endpoint for calls from the phone number. One caveat: you can only look up the last 31 days.
Request body:

{
"interval": "2019-03-02T04:00:00.000Z/2019-04-02T04:00:00.000Z",
"order": "desc",
"orderBy": "conversationStart",
"paging": {
"pageSize": 1,
"pageNumber": 1
},
"segmentFilters": [{
"type": "and",
"predicates": [{
"dimension": "mediaType",
"value": "voice"
}]
}, {
"type": "or",
"predicates": [{
"dimension": "ani",
"value": "13175555555"
}]
}, {
"type": "or",
"predicates": [{
"dimension": "direction",
"value": "inbound"
}, {
"dimension": "direction",
"value": "outbound"
}]
}],
"conversationFilters": [{
"type": "and",
"predicates": [{
"type": "dimension",
"dimension": "conversationEnd",
"operator": "exists"
}]
}]
}


Can I make the interval daily in which the data action will retrieve the caller details every day he calls !

You can use any interval you want, as long as it <= the last 31 days

I mean dynamically generated every time the call hits the IVR!

Sure, just pass the interval as an input to the data action.

Ok thanks, will give it a try and see.

Hi Melissa,

What I'm trying to achieve is that, when someone re-calls after 3 hours from the first call he made then I need to check from within the IVR he's last call and if the last call was made before 3 hours and more then I want to route him to different Workgroup,
so is there a way to achieve this since the interval in the above API will keep changing every time I request it.

Regards,

Hussein

You will send the interval to search as an input parameter to the data action. Use this expression in the flow. This will search from 3 hours ago to now (where now is the time the call started).

Append(ToString(AddHours(Flow.StartDateTimeUtc, -3), "/", ToString(Flow.StartDateTimeUtc,))

Hi Melissa,

I'm trying to implement the action but I'm not able to get the conversationStart in the output as shown below

here is my action
GetCallsWithin3Hours-20190405114200.custom.json (2.2 KB)

could you please tell me what I'm missing !

Regards,

Hussein

The interval needs to be a property of the input schema. You have a hardcoded value of "2019-04-01T00:00:00.000Z/2019-04-04T23:59:59.000Z". This is what my input schema looks like

{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "UserIdRequest",
"description": "A user ID-based request.",
"type": "object",
"required": [
"interval",
"ani"
],
"properties": {
"interval": {
"type": "string",
"description": "The search interval"
},
"ani": {
"type": "string",
"description": "The caller's ANI"
}
}
}

Hi @MelissaBailey,

In fact, I was trying to test how the output will look like, as for the input contract I will start modifying after I get the proper output first but I'm stuck with what's shown in the above screenshot, so could you please check if I'm missing something in the output contract or response configuration !

Regards,

Hussein

conversations in your output schema needs to be an array not an object

{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Analytic lookup",
"description": "Searches for calls based on the ANI & interval",
"type": "object",
"properties": {
"conversations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"conversationStart": {
"type": "string"
}
}
}
}
}
}

1 Like

Still giving me same result ( With and without Flatten output)

That seems to be a UI bug. If you publish the action and use it in a call flow it gets the value.

Hi @MelissaBailey,

I have tried it as you suggested but I'm unable to get the response of ConversationStart in a script as it's always empty.

Here is my implementation

and here is the call details indicating the empty response (3hours att).

image

Thanks

At this point you need to open a support ticket so we can see what exactly happened. Include the conversation id.

1 Like

Hi Melissa,

I just opened a ticket and here's the case number (0002520783) for you reference.

Thanks

Hi @Jason_Mathison,

Could you please help on this matter as the client is pushing and support team is not updating the case so far.

Thanks & regards,

Hussein

If you need to escalate a Care case, please work through your TAM or sales rep. Thank you.