def clear_transcriptions(account_sid, auth_token): client = Client(account_sid, auth_token) transcriptions = [] sids = [] transcriptions = client.transcriptions.list() for transcript in transcriptions: sids.append(transcript.sid) for sid in sids: client.transcriptions(sid).delete() print(sid) return None
def _fetch_twilio_transcription(sid) -> str: # Note: the code below was never successfully tested. # For now it's kept as for reference only # At the very least it requires access to Twilio keys client = Client() #fetch the transcription and assign it return client.transcriptions(sid).fetch()
def message(): #create an of the Client object instance client = Client(account_sid, auth_token) #return the most recent transcription ID from Twilios REST API transcription = client.transcriptions.list(limit=1) #get the sid of the voicemail and store it for our retrieval call sid = transcription[0].sid #fetch the transcription and assign it t = client.transcriptions(sid).fetch() #print the last message print(t.transcription_text) return None
def message(): """ Creates a client object and returns the transcription text to an SMS message""" #create a client object and pass it our secure authentication variables client = Client() #return the most recent transcription ID from Twilios REST API transcription = client.transcriptions.list(limit=1) #get the sid of the voicemail and store it for our retrieval call sid = transcription[0].sid #fetch the transcription and assign it t = client.transcriptions(sid).fetch() #create a text message and send ourselves the text m = client.messages \ .create( body = str(t.transcription_text), from_='<your-twilio-phone-number>', to='<your-personal-phone-number>' ) print(t.transcription_text) print(m.sid) return str(sid)
# Download the Python helper library from twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/user/account account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" auth_token = "your_auth_token" client = Client(account_sid, auth_token) transcription_sid = "TR8c61027b709ffb038236612dc5af8723" transcription = client.transcriptions(transcription_sid).fetch() print(transcription.transcription_text)
# Download the helper library from https://www.twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/console account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' auth_token = 'your_auth_token' client = Client(account_sid, auth_token) transcription = client.transcriptions('TR8c61027b709ffb038236612dc5af8723') \ .fetch() print(transcription.date_created)
# Download the helper library from https://www.twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/console account_sid = '"ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"' auth_token = 'your_auth_token' client = Client(account_sid, auth_token) client.transcriptions("TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete()
# Download the Python helper library from twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/user/account account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" auth_token = "your_auth_token" client = Client(account_sid, auth_token) client.transcriptions("TR8c61027b709ffb038236612dc5af8723").delete()
# Download the helper library from https://www.twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/console # DANGER! This is insecure. See http://twil.io/secure account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' auth_token = 'your_auth_token' client = Client(account_sid, auth_token) transcription = client.transcriptions('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .fetch() print(transcription.date_created)
import logging #write requests & responses from Twilio to log file, useful, IMHO, for debugging: logging.basicConfig( level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s', filename= '/usr/local/twilio/python3/sdkv6x/recordings/logs/twilio_recordings.log', filemode='a') # Your Account Sid and Auth Token from twilio.com/console & stored in Mac OS ~/.bash_profile in this example account_sid = os.environ.get('$TWILIO_ACCOUNT_SID') auth_token = os.environ.get('$TWILIO_AUTH_TOKEN') client = Client(account_sid, auth_token) # A list of recording transcription parameters & their permissable values, comment out (#) those lines not required transcription = client.transcriptions( 'TRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').delete() # print list of all recording transcription properties to console, useful for learning info available you can work with? #print(transcription.account_sid) #print(transcription.date_created) #print(transcription.date_updated) #print(transcription.duration) #print(transcription.price) #print(transcription.price_unit) #print(transcription.recording_sid) #print(transcription.sid) #print(transcription.status) #print(transcription.transcription_text) #print(transcription.uri) # create variable for this transcription
import logging #write requests & responses from Twilio to log file, useful, IMHO, for debugging: logging.basicConfig( level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s', filename= '/usr/local/twilio/python3/sdkv6x/recordings/logs/twilio_recordings.log', filemode='a') # Your Account Sid and Auth Token from twilio.com/console & stored in Mac OS ~/.bash_profile in this example account_sid = os.environ.get('$TWILIO_ACCOUNT_SID') auth_token = os.environ.get('$TWILIO_AUTH_TOKEN') client = Client(account_sid, auth_token) # A list of recording transcription parameters & their permissable values, comment out (#) those lines not required transcription = client.transcriptions( 'TRxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').fetch() #print list of all recording transcription properties to console, useful for learning info available you can work with? print(transcription.account_sid) print(transcription.date_created) print(transcription.date_updated) print(transcription.duration) print(transcription.price) print(transcription.price_unit) print(transcription.recording_sid) print(transcription.sid) print(transcription.status) print(transcription.transcription_text) print(transcription.uri) #create variable for this transcription
# Download the helper library from https://www.twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/console account_sid = '"ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"' auth_token = 'your_auth_token' client = Client(account_sid, auth_token) transcription = client.transcriptions("TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ .fetch() print(transcription.date_created)
# Download the helper library from https://www.twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/console account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' auth_token = 'your_auth_token' client = Client(account_sid, auth_token) client.transcriptions('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()