Retrieving flow outcome data?

I'm attempting to retrieve Flow Outcome data via /api/v2/analytics/conversations/details/query and it doesn't appear to return any data. Can anyone assist? Should type be exists? It's unclear to me how best to retrieve this data.

Here's my request data below.

  {
  	"interval": "2020-01-20T00:00:00+00:00/2020-01-23T23:59:59.999999+00:00",
  	"segment_filters": {
  		"predicates": [{
  				"dimension": "flowId",
  				"operator": "matches",
  				"type": "dimension"
  			},
  			{
  				"dimension": "flowName",
  				"operator": "matches",
  				"type": "dimension"
  			},
  			{
  				"dimension": "flowOutcome",
  				"operator": "matches",
  				"type": "dimension"
  			},
  			{
  				"dimension": "flowOutcomeEndTimestamp",
  				"operator": "matches",
  				"type": "dimension"
  			},
  			{
  				"dimension": "flowOutcomeId",
  				"operator": "matches",
  				"type": "dimension"
  			},
  			{
  				"dimension": "flowOutcomeStartTimestamp",
  				"operator": "matches",
  				"type": "dimension"
  			},
  			{
  				"dimension": "flowOutcomeValue",
  				"operator": "matches",
  				"type": "dimension"
  			},
  			{
  				"dimension": "flowType",
  				"operator": "matches",
  				"type": "dimension"
  			},
  			{
  				"dimension": "flowVersion",
  				"operator": "matches",
  				"type": "dimension"
  			}
  		]
  	},

  	"type": "and"
  }

I don't believe that flow outcomes are stored as part of the conversation, which probably explains why they aren't returning anything when trying to retrieve the conversation details.

As everything in the PureCloud UI is built on the PureCloud API, I went to Performance->Flow Outcomes and opened up the browser's developer tools to sniff the network requests that PureCloud was making to return the data. It appears that a POST to /api/v2/analytics/flows/aggregates/query will get you the aggregated data about flow accounts for a call flow. There is also /api/v2/analytics/flows/observations/query which may return you data about specific flow executions.

Here is an example of the /api/v2/analytics/flows/aggregates/query to get flow outcomes:

POST https://api.mypurecloud.com/api/v2/analytics/flows/aggregates/query
{
	"granularity":"PT30M",
	"filter":{
		"type":"and",
		"clauses":[
			{
				"type":"and",
				"predicates":[
					{
						"type":"dimension",
						"dimension":"flowId",
						"value":"32665256-25ec-4f43-801d-7cb10981fc9e"
					},
					{
						"type":"dimension",
						"dimension":"flowOutcomeId",
						"value":"d5c5b033-b272-401b-a4bc-9c48cfb3a6e7"
					}
				]
			}
		],
		"predicates":[
			{
				"dimension":"mediaType",
				"value":"voice"
			}
		]
	},
	"interval":"2020-01-23T06:00:00.000Z/2020-01-24T06:00:00.000Z"
}

Hope that gives you some direction.

Trevor, have you tried using the Analytics Query Builder developer tool? This makes it really easy to build and validate queries.

Why is it that the endpoint /api/v2/analytics/conversations/details/query includes documentation on querying flowOutcome data? Is this not correct or am I misunderstanding the usage here?

Please excuse my earlier response. It can be done with Conversation Details View. Here is the POST (again I pulled this from the UI via Performance->Interactions and filtered for flow outcomes):

POST https://api.mypurecloud.com/api/v2/analytics/conversations/details/query
{
	"interval":"2020-01-23T06:00:00.000Z/2020-01-24T06:00:00.000Z",
	"order":"desc",
	"orderBy":"conversationStart",
	"paging":{
		"pageSize":1,
		"pageNumber":51
	},
	"segmentFilters":[
		{"type":"or","predicates":[{"dimension":"direction","value":"inbound"},{"dimension":"direction","value":"outbound"}]},
		{"type":"or","predicates":[{"dimension":"flowOutcomeId","value":"d5c5b033-b272-401b-a4bc-9c48cfb3a6e7"}]},
		{"type":"or","predicates":[{"dimension":"flowOutcomeValue","value":"SUCCESS"}]}],
	"conversationFilters":[],
	"evaluationFilters":[],
	"surveyFilters":[],
	"metrics":[]
}

Okay, that makes sense, but is it possible to pull all flowOutcomes data for each segment in the response from api/v2/analytics/conversations/details/query ??

I'm not sure I totally understand what you are asking, but /api/v2/analytics/conversations/details/query will return a list of conversations and their details. If a conversation had a flow outcome, then all of those details about the flow outcome will be returned in the JSON for the "ivr" participant.

Here is an example of the flow outcome properties that came back for me:

              "flow": {
                "flowId": "32665256-25ec-4f43-801d-7cb10981fc9e",
                "flowName": "Default",
                "flowVersion": "14.0",
                "flowType": "INBOUNDCALL",
                "exitReason": "DISCONNECT",
                "entryReason": "tel:+18443572040",
                "entryType": "dnis",
                "issuedCallback": false,
                "startingLanguage": "en-us",
                "endingLanguage": "en-us",
                "outcomes": [
                  {
                    "flowOutcomeId": "d5c5b033-b272-401b-a4bc-9c48cfb3a6e7",
                    "flowOutcomeValue": "SUCCESS",
                    "flowOutcome": "d5c5b033-b272-401b-a4bc-9c48cfb3a6e7:SUCCESS",
                    "flowOutcomeStartTimestamp": "2020-01-23T20:51:07.365Z",
                    "flowOutcomeEndTimestamp": "2020-01-23T20:51:07.365Z"
                  }
                ]
              },

Does that help?

Will this be the response for an "ivr" participant without having to apply any segmentFilters?

That's what's unclear to me because it does not appear when I query /api/v2/analytics/conversations/details/query with just "interval"

If you have flow outcomes defined in Admin, and you use the Initialize Flow Outcome and Set Flow Outcome blocks in the Architect flow, then the "ivr" participant for your inbound call that passed through that Architect flow will contain the "flow" and "outcomes" properties in the conversation details, even when using just an interval. There is nothing in the query itself that you have to specify to say that you want these properties to be returned.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.