Created
October 29, 2018 22:13
-
-
Save dprothero/20600365507f146b7b845e0e285efd5b to your computer and use it in GitHub Desktop.
Using a unique TwilioRestClient for requests
This file contains 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
string accountSid = string.Empty; | |
string authToken = string.Empty; | |
if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["TwilioAccountSID"]) && !string.IsNullOrEmpty(ConfigurationManager.AppSettings["TwilioAuthToken"])) | |
{ | |
accountSid = ConfigurationManager.AppSettings["TwilioAccountSID"]; | |
authToken = ConfigurationManager.AppSettings["TwilioAuthToken"]; | |
var readClient = new TwilioRestClient(accountSid, authToken); | |
var writeClient = new TwilioRestClient(accountSid, authToken); | |
var deleteDateRange = DateTime.UtcNow.AddDays(-1); | |
var recordings = RecordingResource.Read(dateCreatedBefore: deleteDateRange, client: readClient); | |
foreach (var recording in recordings) | |
{ | |
RecordingResource.Delete(recording.Sid, client: writeClient); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment