Azure SMS client library for Python¶
Azure Communication SMS client package is intended to be used to send SMS using an Azure Resource.
Getting started¶
Prerequisites¶
Python 2.7, or 3.5 or later is required to use this package.
You must have an Azure subscription
You must have a phone number configured that is associated with an Azure subscription
Examples¶
The following section provides several code snippets covering some of the most common Azure Communication Services tasks, including:
Client Initialization¶
To initialize the SMS Client, the connection string can be used to instantiate:
connection_string = "COMMUNICATION_SERVICES_CONNECTION_STRING"
sms_client = SmsClient.from_connection_string(connection_string)
Sending an SMS¶
Once the client is initialized, the .send()
method can be invoked:
smsresponse = sms_client.send(
from_phone_number=PhoneNumber("<leased-phone-number>"),
to_phone_numbers=[PhoneNumber("<to-phone-number>")],
message="Hello World via SMS",
send_sms_options=SendSmsOptions(enable_delivery_report=True)) # optional property
leased-phone-number
: an SMS enabled phone number associated with your communication serviceto-phone-number
: the phone number you wish to send a message tosend_sms_options
: an optional parameter that you can use to configure Delivery Reporting. This is useful for scenarios where you want to emit events when SMS messages are delivered.
Troubleshooting¶
Running into issues? This section should contain details as to what to do there.
Next steps¶
More sample code should go here, along with links out to the appropriate example tests.