Created
October 1, 2020 15:15
-
-
Save ninalutz/2e61c54876c061d275ab0c5a6df7c8a6 to your computer and use it in GitHub Desktop.
Get Twilio Recordings
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
""" | |
Gets Twilio recording audio links from a hotline | |
""" | |
account_sid = 'ACCOUNT_SID' | |
auth_token = 'AUTH_TOKEN' | |
twilio_api_header = 'https://%s:%s@api.twilio.com' % (account_sid, auth_token) | |
hotline = 'YOURHOTLINE' | |
client = Client(account_sid, auth_token) | |
user_calls = client.calls.list(to=hotline,status='completed') | |
for call in user_calls: | |
recordings = client.recordings.list(call_sid=call.sid) | |
rec_urls = [] | |
for record in recordings: | |
recording_url_header = '/2010-04-01/Accounts/%s/Recordings/%s.mp3' % (account_sid, record.sid) | |
rec_url = twilio_api_header + recording_url_header | |
rec_urls.append(rec_url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment