There are three steps to integrating the Voice Broadcast API into your Python project.
1. Create an account.
Sign up for an Esendex account. When you register you will receive a license key. You will need this to use the API.
2. Install Python.
Install Python if it is not on your computer already. To check, run this command in your terminal: python --version
PS C:> python --version
Python 3.11.0
Next, make sure you have pip (the Python package installer). This is usually included when you install Python, but you can install pip separately here. To check, run this command in your terminal: python -m pip --version
PS C:> python -m pip --version
pip 22.3 from C:Python311Libsite-packagespip (python 3.11)
3. Send a test phone call.
Install Zeep, a SOAP client for Python. Run this command in your terminal: pip install zeep
Create a new Python file. Let’s call it demo.py.
You can use the NotifyPhoneBasic
method to send a phone call. Add the displayed code to your new file.
Replace the phone_number_to_dial
value with your own phone number.
Replace the license_key
value with your account’s license key.
import zeep
client = zeep.Client(wsdl="https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl")
phone_number_to_dial = "7575559999"
text_to_say = "Hello, this call was sent with Python."
caller_id = ""
caller_id_name = "Test Caller"
voice_id = 0
license_key = "00000000-0000-0000-0000-000000000000"
result = client.service.NotifyPhoneBasic(
phone_number_to_dial, text_to_say, caller_id, caller_id_name, voice_id, license_key
)
print(result["ResponseText"])
Run the project in your terminal with this command: python demo.py
. If the response is Queued, the call has been successfully scheduled. You will receive the phone call shortly.
PS C:PythonDemo> python demo.py
Queued