azure.communication.sms.aio package

class azure.communication.sms.aio.SmsClient(endpoint: str, credential: str, **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 str credential

The credentials with which to authenticate. The value is an account shared access key

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_phone_number: ~ azure.communication.sms.PhoneNumber, to_phone_numbers: list[~ azure.communication.sms.PhoneNumber], message: str, **kwargs: Any) → SendSmsResponse[source]

Sends SMSs to phone numbers.

Parameters
  • from_phone_number (PhoneNumber) – the sender of the SMS.

  • to_phone_numbers (list[PhoneNumber]) – the list of recipients of the SMS.

  • message (str) – The message in the SMS

Keyword Arguments

send_sms_options – the options object to configure delivery reporting.

Returns

The response object with the message_id

Return type

SendMessageResponse: ~azure.communication.sms.models.SendMessageResponse