Share via


NotificationMessagesClient Class

A client to interact with the AzureCommunicationService Messaging service.

This client provides operations to create and update jobs, policies and workers.

Constructor

NotificationMessagesClient(endpoint: str, credential: TokenCredential | AzureKeyCredential, **kwargs: Any)

Parameters

Name Description
endpoint
Required
str

The endpoint of the Azure Communication resource.

credential
Required
Union[<xref:TokenCredential>, <xref:AsyncTokenCredential>]

The credentials with which to authenticate

Keyword-Only Parameters

Name Description
api_version

Azure Communication Messaging API version. Default value is "2023-11-01". Note that overriding this default value may result in unsupported behavior.

Methods

close
download_media

Download the Media payload from a User to Business message.

from_connection_string

Create NotificationMessagesClient from a Connection String.

send

Sends a notification message from Business to User.

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 = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

close

close() -> None

download_media

Download the Media payload from a User to Business message.

download_media(id: str, **kwargs: Any) -> Iterator[bytes]

Parameters

Name Description
id
Required
str

The stream ID. Required.

Returns

Type Description

Iterator[bytes]

Exceptions

Type Description

from_connection_string

Create NotificationMessagesClient from a Connection String.

from_connection_string(conn_str: str, **kwargs: Any) -> NotificationMessagesClient

Parameters

Name Description
conn_str
Required
str

Azure communication service connection string. Required.

Returns

Type Description

instance of NotificationMessagesClient

send

Sends a notification message from Business to User.

send(body: NotificationContent | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> SendMessageResult

Parameters

Name Description
body
Required
NotificationContent or <xref:JSON> or IO[bytes]

Details of the message to send. Is one of the following types: NotificationContent, JSON, IO[bytes] Required.

Returns

Type Description

SendMessageResult. The SendMessageResult is compatible with MutableMapping

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 = client.send_request(request)
<HttpResponse: 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) -> HttpResponse

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.