Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Using Intervals in Data Actions

    Posted 09-19-2025 16:59

    Hi all, I am looking for assistance with creating variable in Architect to pass to a data action for an API that requires an interval. I am looking to create a data action using the /api/v2/analytics/conversations/details/query API to get the total number of calls for the current day received from the ANI of the current call. I want to create a variable in architect for the current day that I can pass as an input to the data action.

    Appreciate any assistance with this request, 


    #Architect
    #DataActions
    #Integrations

    ------------------------------
    Scott Stewart
    ------------------------------


  • 2.  RE: Using Intervals in Data Actions

    Posted 09-19-2025 18:06

    Hey Scott,

    You can use the GetCurrentDateTimeUtc() function to get the Current Date.

    You can also use it in conjunction with the AddHours() function to offset some hours from the UTC, accordingly with your timezone.

    The end result should be something like that: AddHours(GetCurrentDateTimeUtc(),-3) - For a "-3 timezone".

    -----

    The output from that function is a "DateTime" value, that you can convert to a string (by using toString(), or by simply using the function to update a String Variable).

    The value should look like this: 2025-09-19T18:55:23.000Z

    Then, you can use some other functions, like Substring(), to extract just the start of the above string (The date part), and you can manually add the hours as "00:00:00", or any other starting hours, as needed on your timezone. 

    So you should do something like:

    Your_String_Variable = Substring(Your_String_Variable,0,10) + "00:00:00". (or the appropriate hours)

    Then for the end of your intervall, you can just take the above string and add "1 day", something like:

    AddDays(ToDateTime(your_string_variable),1)

    -----

    For the interval, remember to also put a "/" between the startTime and endTime.

    Keep in mind that for the Analytics API you should use the interval without the "timezone offset" applied. So for my timezone (-3), the current day interval would look like this: "2025-09-19T03:00:00.000Z/2025-09-20T03:00:00.000Z".

    -----

    Hope it helps!



    ------------------------------
    Marcello Jabur
    ------------------------------



  • 3.  RE: Using Intervals in Data Actions

    Posted 2 days ago

    Hi Marcello,

    We are also in need of adding interval to call the analytics data action from Pre call rule sets of outbound dialer.

    Could you please elaborate on the expression that we can add in request body template of data action. (We need to pass the interval dynamically from body template and not any architect flow)

    Regards

    Raghunandan



    ------------------------------
    HM Raghunandan
    ------------------------------



  • 4.  RE: Using Intervals in Data Actions

    Posted 2 days ago

    Hi there,

    So, I'm not sure about what you need, and I haven't worked with outbound pre call rules yet, but I will try to at least explain how to create the data action, if that helps you.

    First of all, you need to create a Data Action with your query in que the request body.

    The interval will be part of that query in the body, and you can create a variable in the "input contracts" to define that interval dynamically.

    This should look similar to what I'll show below:

    ---------------

    With the Data Action created, you should now be able to use it in outbound rules (But I'm not 100% sure how to set it up there, since I haven't used it yet).

    I would assume you can pass the interval dynamically on that input variable using a field from the contact list (So the value in the contact list field will be used as an input for the interval).

    Keep in mind that the interval should be in the following format: YYYY-MM-DDThh:mm:ss/YYYY-MM-DDThh:mm:ss

    Which means there are 2 dates there (Initial date, and End date).

    You can simply have that format already defined in the field of your contact list, and use that as the input.


    Not sure if that helps you, but it might be a starting point.

    If you need your interval to be setup dynamically in the body without passing anything as an input (Like always using "last 30 days" or something like that), I'm not sure if there is a way to do that without Architect or a Script, or something else where we can execute some kind of logic to define those values.



    ------------------------------
    Marcello Jabur
    ------------------------------



  • 5.  RE: Using Intervals in Data Actions

    Posted yesterday

    Hi,

    Thank you so much for quick reply and detailed steps.

    But we are in need to call the data action from call rule sets (Pre call) for outbound campaign. So here we will not have any flow or script involved. Hence I was looking for any workaround to pass the interval value to request body template dynamically.

    Regards



    ------------------------------
    HM Raghunandan
    ------------------------------



  • 6.  RE: Using Intervals in Data Actions

    Posted yesterday

    A couple of things. I would suggest voting for this idea to add better date & time support for Data Actions:

    https://genesyscloud.ideas.aha.io/ideas/OP-I-337

    Also, while it might be possible to get a data action to do what you need, it may be pretty ugly. You might consider doing this with Genesys functions or AWS Lambda data actions, where you can write your own code to handle creating the intervals.



    ------------------------------
    --Jason
    ------------------------------