Legacy Dev Forum Posts

 View Only

Sign Up

Reterive last call based on caller ID

  • 1.  Reterive last call based on caller ID

    Posted 06-05-2025 19:09

    husseinco | 2019-03-31 20:04:36 UTC | #1

    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


    MelissaBailey | 2019-04-01 15:23:36 UTC | #2

    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" }] }] }

    https://help.mypurecloud.com/articles/call-data-action/ https://help.mypurecloud.com/articles/about-purecloud-data-actions-integration/


    husseinco | 2019-04-01 16:55:21 UTC | #3

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


    MelissaBailey | 2019-04-01 17:39:26 UTC | #4

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


    husseinco | 2019-04-01 17:40:23 UTC | #5

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


    MelissaBailey | 2019-04-01 17:42:13 UTC | #6

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


    husseinco | 2019-04-01 17:45:58 UTC | #7

    Ok thanks, will give it a try and see.


    husseinco | 2019-04-02 18:28:54 UTC | #8

    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


    MelissaBailey | 2019-04-02 21:55:17 UTC | #9

    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,))


    husseinco | 2019-04-05 08:45:51 UTC | #10

    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 <a class="attachment" href="/forum/uploads/db6296/original/2X/3/39af7983dfc3d17dd896da16e206c67c0fa30f5e.json">GetCallsWithin3Hours-20190405114200.custom.json</a> (2.2 KB)

    could you please tell me what I'm missing !

    Regards,

    Hussein


    MelissaBailey | 2019-04-08 14:24:11 UTC | #11

    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" } } }


    husseinco | 2019-04-08 17:12:02 UTC | #12

    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


    MelissaBailey | 2019-04-08 17:52:55 UTC | #13

    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" } } } } } }


    husseinco | 2019-04-08 18:27:20 UTC | #14

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

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


    MelissaBailey | 2019-04-08 18:37:36 UTC | #15

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


    husseinco | 2019-04-12 21:49:40 UTC | #16

    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).

    Thanks


    MelissaBailey | 2019-04-16 17:23:37 UTC | #17

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


    husseinco | 2019-04-16 20:08:47 UTC | #18

    Hi Melissa,

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

    Thanks


    husseinco | 2019-04-21 09:25:05 UTC | #19

    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


    tim.smith | 2019-04-22 13:51:07 UTC | #20

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


    husseinco | 2019-04-22 18:56:16 UTC | #21

    @tim.smith, Duly noted.

    Thanks.


    system | 2019-05-23 18:56:16 UTC | #22

    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: 4898