from tnzapi import TNZAPI client = TNZAPI( Sender="YOUR_EMAIL_ADDRESS", # API Username APIKey="YOUR_API_KEY", # API Key ) request = client.Send.TTS() request.MessageID = "ID12345" # MessageID - Leave blank to auto-generate request.Reference = "Test TTS - Advanced version" # Reference request.CallerID = "+6499999999" # Caller ID request.BillingAccount = "TEST BILLING ACCOUNT" # Billing Account (Sub Account) request.ReportTo = "report@example.com" # Email address to receive reports request.NumberOfOperators = 10 # No of Operators - Limits the maximum simultaneous calls request.RetryAttempts = 3 # No of retries request.RetryPeriod = 1 # Period between retries (minutes) request.TTSVoiceType = "Female1" # TTS Voice Engine # # Message to play when call answered # request.MessageToPeople = "Hello, this is a call from Department01. This is relevant information. Press one to be connected to our call centre." # # Message to play when answerphone detected # request.MessageToAnswerPhones = "Hello, sorry we missed you. This is a call from Department 01. Please contact us on 0800 123123." # # Message to play when a keypad option is pressed # request.CallRouteMessageToPeople = "Connecting you now." # # Message to play when a all centre representative answering the connected call # request.CallRouteMessageToOperators = "Incoming Text To Speech call." # # Message to play when an unregistered keypad button is pressed # request.CallRouteMessageOnWrongKey = "Sorry, you have pressed an invalid key. Please try again." # # Adding Keypad options # request.AddKeypad(Tone=1,RouteNumber="+6491111111") request.AddKeypad(Tone=2,RouteNumber="+6492222222",Play="You pressed 1") request.Recipients = [ { "Recipient": "+64211111111", # Recipient Phone Number "Company": "Company 1", # Company "Attention": "Person 1", # Attention "Custom1": "Custom1", # Custom Field "Custom2": "Custom2", "Custom3": "Custom3", "Custom4": "Custom4" }, { "Recipient": "+64212222222", # Recipient Phone Number "Company": "Company 2", # Company "Attention": "Person 2", # Attention "Custom1": "Custom1", # Custom Field "Custom2": "Custom2", "Custom3": "Custom3", "Custom4": "Custom4" } ] response = request.SendMessage() print(repr(response))