Delete all recordings associated with a caller (V2)

If your communications processes involve capturing and managing call recordings, the recording management section of the babelforce manager interface gives you powerful filtering and flag/tag functionality. But due to the sensitivity of recordings and their implications for data protection, you also need to be able to act quickly to comply with customer requests regarding audio files. 

A common requirement is the ability to automatically and instantly delete any call recordings which are associated with a certain caller. You could use the manager app's interface to do it, but that can be laborious. 

Instead, leverage the power of our standard APIs: find and remove recordings by just referencing the number(s) of the customer who has requested their deletion. For those of you familiar with the command line, here is a small BASH script example showing a way to do this:

#!/bin/bash

set -e

ACCESS_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
ACCESS_TOKEN="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx"

IDS=$(curl -sX GET "https://services.babelforce.com/api/v2/recordings?q=${1}&max=500" \
    -H "X-Auth-Access-Id: ${ACCESS_ID}" \
    -H "X-Auth-Access-Token: ${ACCESS_TOKEN}" | jq -r '.items[].id')

COUNT=$(curl -sX GET "https://services.babelforce.com/api/v2/recordings?q=${1}&max=500" \
    -H "X-Auth-Access-Id: ${ACCESS_ID}" \
    -H "X-Auth-Access-Token: ${ACCESS_TOKEN}" | jq '.items | length')

echo
echo "There are ${COUNT} recordings associated with the number ${1}"
echo
read -p "Are you sure you want to delete these recordings? (y/n): " -n 1 -r
echo

if [[ $REPLY =~ ^[Yy]$ ]]
then
    for ID in $IDS; do
        echo
        echo "Deleting recording ${ID}..."
        echo "----------------------------"
        curl -sX DELETE "https://staging.babelforce.com/api/v2/recordings/${ID}" \
            -H "Content-Type: application/json" \
            -H "X-Auth-Access-Id: ${ACCESS_ID}" \
            -H "X-Auth-Access-Token: ${ACCESS_TOKEN}" \
            -d "{\"id\": \"${ID}\"}" | jq '. | {"success": .success, "message": .message}'
    done
fi



After saving it as an executable file, you would then run it like this:

$ ./script.sh 491704184334

And this is what it looks like running:

Selection_999_191_.png

Have more questions? Submit a request