-
-
Save po5i/a05b1b074d97f5ad4d17181f1bb7804e to your computer and use it in GitHub Desktop.
This is a simple script using the Twilio PHP Helper library to retrieve Recordings within a certain date range and then delete them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get the PHP helper library from https://twilio.com/docs/libraries/php | |
require_once '/path/to/vendor/autoload.php'; | |
use Twilio\Rest\Client; | |
// Your Account Sid and Auth Token from twilio.com/console | |
$sid = "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | |
$token = "your_auth_token"; | |
$twilio = new Client($sid, $token); | |
$recordings = $twilio->recordings | |
->read(array( | |
'callSid' => "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", | |
'dateCreatedBefore' => '2011-08-01' | |
'dateCreatedAfter' => '2011-07-05 08:00:00' | |
), 50); | |
foreach ($recordings as $record) { | |
echo "Deleting: " . $recording->sid . " -- " . $recording->date_created . "\n"; | |
$client->recordings($recording->sid)->delete(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment