Skip to content

Instantly share code, notes, and snippets.

@ninalutz
Created October 1, 2020 15:15
Show Gist options
  • Save ninalutz/2e61c54876c061d275ab0c5a6df7c8a6 to your computer and use it in GitHub Desktop.
Save ninalutz/2e61c54876c061d275ab0c5a6df7c8a6 to your computer and use it in GitHub Desktop.
Get Twilio Recordings
"""
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