I wanted to put an answer to this question, for anyone who might come across this post in future.
The issue was resolved with the creation of the following Data Action:
Input Contract:
{
"title": "INPUTS",
"type": "object",
"additionalProperties": true,
"properties": {
"interval": {
"type": "string"
},
"phoneNumber": {
"type": "string"
}
}
}
Output Contract:
{
"title": "OUTPUT",
"type": "object",
"additionalProperties": true,
"properties": {
"count": {
"type": "integer"
},
"outboundCampaignId": {
"type": "string"
},
"outboundContactId": {
"type": "string"
},
"outboundContactListId": {
"type": "string"
}
}
}
Configuration:
POST /api/v2/analytics/conversations/details/query
Request Body Template
{
"interval": "${input.interval}",
"segmentFilters": [
{
"type": "and",
"predicates": [
{
"type": "dimension",
"dimension": "dnis",
"operator": "matches",
"value": "tel:${input.phoneNumber}"
},
{
"type": "dimension",
"dimension": "mediaType",
"operator": "matches",
"value": "voice"
}
]
}
]
}
Response Template
{
"translationMap": {
"count": "$.totalHits",
"outboundContactId": "$.conversations[0].participants[0].sessions[0].outboundContactId",
"outboundContactListId": "$.conversations[0].participants[0].sessions[0].outboundContactListId",
"outboundCampaignId": "$.conversations[0].participants[0].sessions[0].outboundCampaignId"
},
"translationMapDefaults": {
"count": "0",
"outboundContactId": "\"\"",
"outboundContactListId": "\"\"",
"outboundCampaignId": "\"\""
},
"successTemplate": "{\"count\":${count},\"outboundCampaignId\":${outboundCampaignId},\"outboundContactId\":${outboundContactId},\"outboundContactListId\":${outboundContactListId}}"
}
The interval we use is from midnight until the current time of the current day. This returns the number of calls placed to the targeted ANI number.
With the returned value, a decision step in an outbound flow can be use to triggering whether or not to leave a voicemail, when the Answer Machine outcome is activated.
------------------------------
Ruud Reinold
BNP Paribas Personal Finance UK
------------------------------