Legacy Dev Forum Posts

 View Only

Sign Up

Help creating data action to search callbacks

  • 1.  Help creating data action to search callbacks

    Posted 06-05-2025 18:40

    Dave_Sanders | 2017-10-31 21:29:53 UTC | #1

    I am trying to use the new bridge actions to query and see if there is a callback for a number already in the queue. I have setup the following items. I am getting results back, but they aren't being filtered correctly. Also, I would like to restrict this to calls that are actively queued not completed.

    Input Contract


    { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [ "ani", "interval" ], "properties": { "ani": { "description": "ani (eg. tel:+16614317650)", "type": "string" }, "interval": { "description": "interval (eg. 2017-10-26T00:00:00.000Z/2017-10-31T23:59:59.999Z)", "type": "string" } } }

    Output Contract


    { "properties": { "conversations": { "type": "array" } } }

    Request


    { "requestUrlTemplate": "/api/v2/analytics/conversations/details/query", "requestType": "POST", "headers": { "UserAgent": "PureCloudIntegrations/1.0", "Content-Type": "application/json" }, "requestTemplate": "${input.rawRequest}" }

    Response


    { "translationMap": {}, "successTemplate": "${rawResult}" }


    Jason_Mathison | 2017-11-01 16:17:03 UTC | #2

    Take a look at this forum conversionation about getting active callbacks. Hopefully it will get you going in the right direction.

    https://developer.mypurecloud.com/forum/t/retrieving-all-callback-converstations/1980


    ChrisDibble | 2017-11-01 16:34:20 UTC | #3

    Hi Dave,

    I asked around and it doesnt look like you can filter by callback number. It looks like you'll have to query for all callbacks in the queue and iterate over the results to find a match. Here's the request you can send to get all the callbacks (assuming filtering on mediaType=callback and queueId):

    { "interval": "2017-11-01T06:00:00.000Z/2017-11-02T06:00:00.000Z", "order": "asc", "orderBy": "conversationStart", "paging": { "pageSize": "100", "pageNumber": "1" }, "segmentFilters": [ { "type": "and", "predicates": [ { "type": "dimension", "dimension": "mediaType", "operator": "matches", "value": "callback" }, { "type": "dimension", "dimension": "queueId", "operator": "matches", "value": "d1558db4-df3f-4471-9467-1106a55fd6a7" } ] } ] }

    Then you would have to filter that down in your response configuration by using the translation map. Give me a bit to find the correct syntax and I'll update this thread with instructions.

    -Chris


    Dave_Sanders | 2017-11-01 17:12:08 UTC | #4

    Thanks! That gets me the list. Now I need to figure out how to use the response and output to create a list I can search.


    ChrisDibble | 2017-11-01 18:52:21 UTC | #5

    Hi Dave. I can make the output a little simpler but I don't have a complete solution that can be accomplished just in the action config.

    Here's what I've got.

    In your response config, you can set it up to look like this:

    { "translationMap": { "callbackNumbers": "$..callbackNumbers.[*]" }, "successTemplate": "{ \"callbackNumbers\" : ${callbackNumbers} }" }

    That will give you all the callback numbers returned from your query, which will look something like this

    { "callbackNumbers": [ "+13175555555", "+12312312312", "+12312312344", "+12312312312" ] } Then you'd have to search that in architect. Doing the final filter in the action is not currently possible because we don't allow the input variables to be referenced in the response configuration for security reasons.

    I hope this helps.

    -Chris


    Dave_Sanders | 2017-11-01 19:19:51 UTC | #6

    Thanks Chris, That is a huge help.

    I am looking at the definitions from the api tool and show that interval was optional, but it is required in the action. I only want to select active callbacks from the list, but by giving the interval I am believing that I am getting callbacks with any status. Can you confirm?

    interval (string, optional): Specifies the date and time range of data being queried. Results will include conversations that started, ended, or had any activity during the interval. Intervals are represented as an ISO-8601 string. For example: YYYY-MM-DDThh:mm:ss/YYYY-MM-DDThh:mm:ss


    tim.smith | 2017-11-01 19:23:43 UTC | #7

    If you don't apply any filters other than the ones Chris listed, you'll get all callbacks for the given queue that existed during any part of the specified interval. That includes callbacks being handled by agents as well as callbacks that have been handled and disconnected. Take a look at the post referenced by Jason above for some additional tips on filtering.


    system | 2017-12-02 19:24:06 UTC | #8

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