Skip to content

Python SDK Guide

The Azure Communication Services (ACS) Python SDK provides robust tools for managing identities, sending SMS and emails, and facilitating chat communications.

SDK Packages

The SDK is modular, allowing you to install only the features you need.

Feature Package
Identity azure-communication-identity
SMS azure-communication-sms
Email azure-communication-email
Chat azure-communication-chat
Phone Numbers azure-communication-phonenumbers
Call Automation azure-communication-callautomation

Prerequisites

  • Python 3.8 or later
  • An active Azure subscription
  • An ACS resource (see Local Setup)

Quick Start: Send SMS

from azure.communication.sms import SmsClient

connection_string = "YOUR_CONNECTION_STRING"
sms_client = SmsClient.from_connection_string(connection_string)

response = sms_client.send(
    from_="<registered-phone-number>",
    to=["<recipient-phone-number>"],
    content="Hello from ACS Python SDK!"
)

print(f"Message ID: {response[0].message_id}")

SDK Workflow

The general workflow for ACS Python SDKs involves initializing a client and performing operations using that client.

graph TD
    Config[Config / Env Vars] --> ClientInit[Initialize Client]
    ClientInit --> Operation[Perform Operation]
    Operation --> Response[Handle Response / Exceptions]

Explore More

  • Tutorials: Step-by-step guides for common scenarios.
  • Recipes: Focused code snippets for specific tasks.

Sources