.. image:: https://dev.azure.com/azure-sdk/public/_apis/build/status/azure-sdk-for-python.client?branchName=master :target: https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=46?branchName=master :alt: Build Status Azure Communication SMS Package client library for Python ========================================================= This package contains a Python SDK for Azure Communication Services for SMS. Read more about Azure Communication Services `here `_ Getting started --------------- Prerequisites ^^^^^^^^^^^^^ * Python 2.7, or 3.5 or later is required to use this package. * An Azure Communication Resource, learn how to create one from `Create an Azure Communication Resource `_ * You must have a phone number configured that is associated with an Azure subscription Install the package ^^^^^^^^^^^^^^^^^^^ Install the Azure Communication SMS client library for Python with `pip `_\ : .. code-block:: bash pip install azure-communication-sms Key concepts ------------ Azure Communication SMS package is used to do following: * Send an SMS Examples -------- The following section provides several code snippets covering some of the most common Azure Communication Services tasks, including: * `Client Initialization <#client-initialization>`_ * `Sending an SMS <#sending-an-sms>`_ Client Initialization ^^^^^^^^^^^^^^^^^^^^^ To initialize the SMS Client, the connection string can be used to instantiate: .. code-block:: Python 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: .. code-block:: Python smsresponse = sms_client.send( from_phone_number=PhoneNumber(""), to_phone_numbers=[PhoneNumber("")], 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 service * ``to-phone-number``\ : the phone number you wish to send a message to * ``send_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 --------------- The Azure Communication Service Identity client will raise exceptions defined in [Azure Core][azure_core]. Next steps ---------- More sample code ^^^^^^^^^^^^^^^^ Please take a look at the `samples `_ directory for detailed examples of how to use this library to send an sms. Provide Feedback ---------------- If you encounter any bugs or have suggestions, please file an issue in the `Issues `_ section of the project Contributing ------------ This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. This project has adopted the `Microsoft Open Source Code of Conduct `_. For more information see the `Code of Conduct FAQ `_ or contact `opencode@microsoft.com `_ with any additional questions or comments. Indices and tables ------------------ * :ref:`genindex` * :ref:`modindex` * :ref:`search` .. toctree:: :maxdepth: 5 :glob: :caption: Developer Documentation azure.communication.sms.rst