Skip to content

Commit e51ae43

Browse files
authored
Merge pull request MicrosoftDocs#1266 from azure-sdk/onboarding-azure-communication-sms-774575
Docs.MS Release Updates for azure-communication-sms
2 parents a778f15 + 0767f49 commit e51ae43

File tree

2 files changed

+66
-35
lines changed

2 files changed

+66
-35
lines changed

ci-configs/packages-preview.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@
365365
"prefer_source_distribution": "true",
366366
"name": "azure-communication-sms",
367367
"install_type": "pypi",
368-
"version": ">=1.0.0b3"
368+
"version": ">=1.0.0b6"
369369
},
370370
"exclude_path": [
371371
"test*",
Lines changed: 65 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Azure SMS client library for Python
2+
title: Azure Communication SMS Package client library for Python
33
keywords: Azure, python, SDK, API, azure-communication-sms, communication
44
author: maggiepint
55
ms.author: magpint
6-
ms.date: 10/09/2020
6+
ms.date: 03/10/2021
77
ms.topic: article
88
ms.prod: azure
99
ms.technology: azure
@@ -13,74 +13,105 @@ ms.service: communication
1313

1414
[![Build Status](https://dev.azure.com/azure-sdk/public/_apis/build/status/azure-sdk-for-python.client?branchName=master)](https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=46?branchName=master)
1515

16-
# Azure SMS client library for Python - Version 1.0.0b3
16+
# Azure Communication SMS Package client library for Python - Version 1.0.0b6
1717

1818

19-
Azure Communication SMS client package is intended to be used to send SMS using an Azure Resource.
19+
This package contains a Python SDK for Azure Communication Services for SMS.
20+
Read more about Azure Communication Services [here](https://docs.microsoft.com/azure/communication-services/overview)
2021

21-
# Getting started
22+
[Source code](https://github.com/Azure/azure-sdk-for-python/blob/azure-communication-sms_1.0.0b6/sdk/communication/azure-communication-sms) | [Package (Pypi)](https://pypi.org/project/azure-communication-sms/) | [API reference documentation](https://github.com/Azure/azure-sdk-for-python/blob/azure-communication-sms_1.0.0b6/sdk/communication/azure-communication-sms) | [Product documentation](https://docs.microsoft.com/azure/communication-services/quickstarts/telephony-sms/send?pivots=programming-language-python)
2223

23-
## Prerequisites
2424

25-
* Python 2.7, or 3.5 or later is required to use this package.
26-
* You must have an [Azure subscription](https://azure.microsoft.com/free/)
27-
* You must have a phone number configured that is associated with an Azure subscription
2825

29-
## Install the package
26+
## Getting started
27+
28+
### Prerequisites
29+
30+
- Python 2.7, or 3.5 or later is required to use this package.
31+
- A deployed Communication Services resource. You can use the [Azure Portal](https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource?tabs=windows&pivots=platform-azp) or the [Azure PowerShell](https://docs.microsoft.com/powershell/module/az.communication/new-azcommunicationservice) to set it up.
32+
- You must have a phone number configured that is associated with an Azure subscription
33+
34+
### Install the package
3035

3136
Install the Azure Communication SMS client library for Python with [pip](https://pypi.org/project/pip/):
3237

3338
```bash
34-
pip install azure-communication-sms --pre
39+
pip install azure-communication-sms
3540
```
3641

37-
# Key concepts
42+
## Key concepts
3843

3944
Azure Communication SMS package is used to do following:
40-
- Send an SMS
45+
- Send SMS Messages
4146

42-
# Examples
47+
## Examples
4348

4449
The following section provides several code snippets covering some of the most common Azure Communication Services tasks, including:
4550

46-
<!-- - [Client Initialization](#client-initialization)
47-
- [Sending an SMS](#sending-an-sms) -->
51+
- [Client Initialization](#client-initialization)
52+
- [Sending SMS Messages](#sending--zsms)
4853

49-
## Client Initialization
54+
### Client Initialization
5055

51-
To initialize the SMS Client, the connection string can be used to instantiate:
56+
To initialize the SMS Client, the connection string can be used to instantiate.
57+
Alternatively, you can also use Active Directory authentication using DefaultAzureCredential.
5258

5359
```Python
54-
connection_string = "COMMUNICATION_SERVICES_CONNECTION_STRING"
60+
from azure.communication.sms import SmsClient
61+
from azure.identity import DefaultAzureCredential
62+
63+
connection_str = os.getenv('AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING')
5564
sms_client = SmsClient.from_connection_string(connection_string)
65+
# To use Azure Active Directory Authentication (DefaultAzureCredential) make sure to have
66+
# AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET as env variables.
67+
endpoint = os.getenv('AZURE_COMMUNICATION_SERVICE_ENDPOINT')
68+
sms_client = SmsClient(endpoint, DefaultAzureCredential())
5669
```
5770

58-
## Sending an SMS
71+
### Sending SMS Messages
5972

6073
Once the client is initialized, the `.send()` method can be invoked:
6174

6275
```Python
63-
smsresponse = sms_client.send(
64-
from_phone_number=PhoneNumber("<leased-phone-number>"),
65-
to_phone_numbers=[PhoneNumber("<to-phone-number>")],
76+
from azure.communication.sms import SendSmsOptions
77+
78+
sms_responses = sms_client.send(
79+
from_phone_number=PhoneNumberIdentifier("<leased-phone-number>"),
80+
to_phone_numbers=["<to-phone-number-1>", "<to-phone-number-2>", "<to-phone-number-3>"],
6681
message="Hello World via SMS",
67-
send_sms_options=SendSmsOptions(enable_delivery_report=True)) # optional property
82+
enable_delivery_report=True, # optional property
83+
tag="custom-tag") # optional property
6884
```
6985

70-
- `leased-phone-number`: an SMS enabled phone number associated with your communication service
71-
- `to-phone-number`: the phone number you wish to send a message to
72-
- `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.
86+
- `from_phone_number`: An SMS enabled phone number associated with your communication service.
87+
- `to_phone_numbers`: The phone numbers you wish to send a message to.
88+
- `message`: The message that you want to send.
89+
- `enable_delivery_report`: 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.
90+
- `tag`: An optional parameter that you can use to configure custom tagging.
91+
92+
93+
## Troubleshooting
94+
The Azure Communication Service Identity client will raise exceptions defined in [Azure Core](https://github.com/Azure/azure-sdk-for-python/blob/azure-communication-sms_1.0.0b6/sdk/core/azure-core/README.md).
95+
96+
## Next steps
97+
### More sample code
98+
99+
Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-python/tree/azure-communication-sms_1.0.0b6/sdk/communication/azure-communication-sms/samples) directory for detailed examples of how to use this library to send an sms.
73100

74-
# Troubleshooting
101+
## Provide Feedback
75102

76-
Running into issues? This section should contain details as to what to do there.
103+
If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project
77104

78-
# Next steps
105+
## Contributing
79106

80-
More sample code should go here, along with links out to the appropriate example tests.
107+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
108+
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.
81109

82-
# Contributing
110+
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the
111+
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.
83112

84-
If you encounter any bugs or have suggestions, please file an issue in the [Issues](<https://github.com/Azure/azure-sdk-for-python/issues>) section of the project.
113+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
114+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
85115

86-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Ftemplate%2Fazure-template%2FREADME.png)
116+
<!-- LINKS -->
117+
[azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/azure-communication-sms_1.0.0b6/sdk/core/azure-core/README.md

0 commit comments

Comments
 (0)