Notification Messages - Send Message
POST {endpoint}/messages/notifications/:send?api-version=2023-08-24-preview
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
endpoint
|
path | True |
string (url) |
The communication resource, for example https://my-resource.communication.azure.com |
|
api-version
|
query | True |
string |
Version of API to invoke. |
Request Body
| Name | Required | Type | Description |
|---|---|---|---|
| channelRegistrationId | True |
string |
The Channel Registration ID for the Business Identifier. |
| to | True |
string[] |
The native external platform user identifiers of the recipient. |
| type | True |
The type of message. Supports text, image, template. |
|
| content |
string |
Message content. |
|
| mediaUri |
string |
A media url for the file. Required if the type is one of the supported media types, e.g. image |
|
| template |
The template object used to create templates. |
Responses
| Name | Type | Description |
|---|---|---|
| 202 Accepted |
Accepted |
|
| Other Status Codes |
Communication |
Communication Error Response |
Examples
Send a notification message
Sample request
POST https://my-resource.communication.azure.com/messages/notifications/:send?api-version=2023-08-24-preview
{
"channelRegistrationId": "0f0eb78e-a576-1dfc-b414-0f0756de3338",
"to": [
"14250000000"
],
"type": "text",
"content": "Text message through CPM"
}
Sample response
{
"receipts": [
{
"messageId": "320fc2a1-4c4b-4387-9c1a-bd38b57795de",
"to": "14250000000"
}
]
}
Definitions
| Name | Description |
|---|---|
|
Communication |
The type of message. Supports text, image, template. |
|
Message |
Receipt of the sending one message. |
|
Message |
The template object used to create templates. |
|
Message |
The binding object to link values to the template specific locations |
|
Message |
The template bindings for WhatsApp |
|
Message |
The template bindings component button for WhatsApp |
|
Message |
The template bindings component for WhatsApp |
|
Message |
The message template's location value information. |
|
Message |
The class describes a parameter of a template. |
|
Message |
The template value kind. |
|
Message |
The message template's media value information. Could be an image, document or video. |
|
Message |
The message template's quick action value information. |
|
Message |
The message template's text value information. |
|
Message |
The WhatsApp button sub type |
|
Send |
Result of the send message operation. |
|
Send |
Details of the message to send. |
CommunicationMessageType
The type of message. Supports text, image, template.
| Value | Description |
|---|---|
| text | |
| image | |
| template |
MessageReceipt
Receipt of the sending one message.
| Name | Type | Description |
|---|---|---|
| messageId |
string |
The message id. |
| to |
string |
The native external platform user identifier of the recipient. |
MessageTemplate
The template object used to create templates.
| Name | Type | Description |
|---|---|---|
| bindings |
The binding object to link values to the template specific locations |
|
| language |
string |
The codes for the supported languages for templates. |
| name |
string |
Name of the template. |
| values |
<string,
Message |
The template values. |
MessageTemplateBindings
The binding object to link values to the template specific locations
| Name | Type | Description |
|---|---|---|
|
The template bindings for WhatsApp |
MessageTemplateBindingsWhatsApp
The template bindings for WhatsApp
| Name | Type | Description |
|---|---|---|
| body |
The template bindings component for WhatsApp |
|
| button |
The template bindings component button for WhatsApp |
|
| footer |
The template bindings component for WhatsApp |
|
| header |
The template bindings component for WhatsApp |
MessageTemplateBindingsWhatsAppButton
The template bindings component button for WhatsApp
| Name | Type | Description |
|---|---|---|
| refValue |
string |
The reference to the value in the Microsoft.Azure.Communication.CrossPlatformMessages.Contract.Model.Notifications.V1.Requests.MessageTemplate.Values dictionary. |
| subType |
The WhatsApp button sub type |
MessageTemplateBindingsWhatsAppComponent
The template bindings component for WhatsApp
| Name | Type | Description |
|---|---|---|
| refValue |
string |
The reference to the value in the Microsoft.Azure.Communication.CrossPlatformMessages.Contract.Model.Notifications.V1.Requests.MessageTemplate.Values dictionary. |
MessageTemplateParameterLocation
The message template's location value information.
| Name | Type | Description |
|---|---|---|
| address |
string |
The [Optional] address of the location. |
| latitude |
number (double) |
The latitude of the location. |
| longitude |
number (double) |
The longitude of the location. |
| name |
string |
The [Optional] name of the location. |
MessageTemplateValue
The class describes a parameter of a template.
| Name | Type | Description |
|---|---|---|
| document |
The message template's media value information. Could be an image, document or video. |
|
| image |
The message template's media value information. Could be an image, document or video. |
|
| kind |
The template value kind. |
|
| location |
The message template's location value information. |
|
| quickAction |
The message template's quick action value information. |
|
| text |
The message template's text value information. |
|
| video |
The message template's media value information. Could be an image, document or video. |
MessageTemplateValueKind
The template value kind.
| Value | Description |
|---|---|
| text | |
| image | |
| document | |
| video | |
| location | |
| quick_action |
MessageTemplateValueMedia
The message template's media value information. Could be an image, document or video.
| Name | Type | Description |
|---|---|---|
| caption |
string |
The [optional] caption of the media object. |
| fileName |
string |
The [optional] filename of the media file. |
| url |
string (uri) |
The (public) URL of the media. |
MessageTemplateValueQuickAction
The message template's quick action value information.
| Name | Type | Description |
|---|---|---|
| payload |
string |
The [Optional] quick action payload |
| text |
string |
The [Optional] quick action text |
MessageTemplateValueText
The message template's text value information.
| Name | Type | Description |
|---|---|---|
| text |
string |
The text value. |
MessageTemplateValueWhatsAppSubType
The WhatsApp button sub type
| Value | Description |
|---|---|
| quickReply | |
| url |
SendMessageResult
Result of the send message operation.
| Name | Type | Description |
|---|---|---|
| receipts |
Receipts of the send message operation. |
SendNotificationRequest
Details of the message to send.
| Name | Type | Description |
|---|---|---|
| channelRegistrationId |
string |
The Channel Registration ID for the Business Identifier. |
| content |
string |
Message content. |
| mediaUri |
string |
A media url for the file. Required if the type is one of the supported media types, e.g. image |
| template |
The template object used to create templates. |
|
| to |
string[] |
The native external platform user identifiers of the recipient. |
| type |
The type of message. Supports text, image, template. |