azure.communication.sms.aio package

class azure.communication.sms.aio.SmsClient(endpoint: str, credential: AsyncTokenCredential, **kwargs: Any)[source]

A client to interact with the AzureCommunicationService Sms gateway asynchronously.

This client provides operations to send an SMS via a phone number.

Parameters

endpoint (str) –

The endpoint url for Azure Communication Service resource.

param AsyncTokenCredential credential

The AsyncTokenCredential we use to authenticate against the service.

async close()None[source]

Close the :class: ~azure.communication.administration.aio.SMSClient session.

classmethod from_connection_string(conn_str: str, **kwargs: Any) → SmsClient[source]

Create SmsClient from a Connection String.

Parameters

conn_str (str) – A connection string to an Azure Communication Service resource.

Returns

Instance of SmsClient.

Return type

SmsClient

Example:

async send(from_: str, to: Union[str, List[str]], message: str, **kwargs: Any)[SmsSendResult][source]

Sends SMSs to phone numbers.

Parameters
  • from (str) – The sender of the SMS.

  • to (Union[str, List[str]]) – The single recipient or the list of recipients of the SMS.

  • message (str) – The message in the SMS

Keyword Arguments
  • enable_delivery_report (bool) – Enable this flag to receive a delivery report for this message on the Azure Resource EventGrid.

  • tag (str) – Use this field to provide metadata that will then be sent back in the corresponding Delivery Report.

Returns

A list of SmsSendResult.

Return type

[SmsSendResult]