MessageTemplateClient Class
A client to interact with the AzureCommunicationService Messaging service.
This client allows you to send and receive WhatsApp template messages using the Azure Communication Services Messaging SDK.
Constructor
MessageTemplateClient(endpoint: str, credential: AsyncTokenCredential | AzureKeyCredential, **kwargs: Any)
Parameters
| Name | Description |
|---|---|
|
endpoint
Required
|
The endpoint of the Azure Communication resource. |
|
credential
Required
|
The credentials with which to authenticate |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
api_version
|
Azure Communication Messaging API version. Default value is "2024-02-01". Note that overriding this default value may result in unsupported behavior. |
Methods
| close | |
| from_connection_string |
Create MessageTemplateClient from a Connection String. |
| list_templates |
List all templates for given Azure Communication Services channel. |
| send_request |
Runs the network request through the client's chained policies.
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request |
close
async close() -> None
from_connection_string
Create MessageTemplateClient from a Connection String.
from_connection_string(conn_str: str, **kwargs: Any) -> MessageTemplateClient
Parameters
| Name | Description |
|---|---|
|
conn_str
Required
|
Azure Communication Service endpoint. Required. |
Returns
| Type | Description |
|---|---|
|
instance of MessageTemplateClient. |
list_templates
List all templates for given Azure Communication Services channel.
list_templates(channel_id: str, **kwargs: Any) -> AsyncIterable[MessageTemplateItem]
Parameters
| Name | Description |
|---|---|
|
channel_id
Required
|
The registration ID of the channel. Required. |
Returns
| Type | Description |
|---|---|
|
An iterator like instance of MessageTemplateItem |
Exceptions
| Type | Description |
|---|---|
send_request
Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client.send_request(request)
<AsyncHttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
send_request(request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> Awaitable[AsyncHttpResponse]
Parameters
| Name | Description |
|---|---|
|
request
Required
|
The network request you want to make. Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
stream
|
Whether the response payload will be streamed. Defaults to False. Default value: False
|
Returns
| Type | Description |
|---|---|
|
The response of your network call. Does not do error handling on your response. |