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

CommunicationMessageType

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

MessageTemplate

The template object used to create templates.

Responses

Name Type Description
202 Accepted

SendMessageResult

Accepted

Other Status Codes

CommunicationErrorResponse

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
CommunicationMessageType

The type of message. Supports text, image, template.

MessageReceipt

Receipt of the sending one message.

MessageTemplate

The template object used to create templates.

MessageTemplateBindings

The binding object to link values to the template specific locations

MessageTemplateBindingsWhatsApp

The template bindings for WhatsApp

MessageTemplateBindingsWhatsAppButton

The template bindings component button for WhatsApp

MessageTemplateBindingsWhatsAppComponent

The template bindings component for WhatsApp

MessageTemplateParameterLocation

The message template's location value information.

MessageTemplateValue

The class describes a parameter of a template.

MessageTemplateValueKind

The template value kind.

MessageTemplateValueMedia

The message template's media value information. Could be an image, document or video.

MessageTemplateValueQuickAction

The message template's quick action value information.

MessageTemplateValueText

The message template's text value information.

MessageTemplateValueWhatsAppSubType

The WhatsApp button sub type

SendMessageResult

Result of the send message operation.

SendNotificationRequest

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

MessageTemplateBindings

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,  MessageTemplateValue>

The template values.

MessageTemplateBindings

The binding object to link values to the template specific locations

Name Type Description
whatsApp

MessageTemplateBindingsWhatsApp

The template bindings for WhatsApp

MessageTemplateBindingsWhatsApp

The template bindings for WhatsApp

Name Type Description
body

MessageTemplateBindingsWhatsAppComponent[]

The template bindings component for WhatsApp

button

MessageTemplateBindingsWhatsAppButton[]

The template bindings component button for WhatsApp

footer

MessageTemplateBindingsWhatsAppComponent[]

The template bindings component for WhatsApp

header

MessageTemplateBindingsWhatsAppComponent[]

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

MessageTemplateValueWhatsAppSubType

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

MessageTemplateValueMedia

The message template's media value information. Could be an image, document or video.

image

MessageTemplateValueMedia

The message template's media value information. Could be an image, document or video.

kind

MessageTemplateValueKind

The template value kind.

location

MessageTemplateParameterLocation

The message template's location value information.

quickAction

MessageTemplateValueQuickAction

The message template's quick action value information.

text

MessageTemplateValueText

The message template's text value information.

video

MessageTemplateValueMedia

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

MessageReceipt[]

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

MessageTemplate

The template object used to create templates.

to

string[]

The native external platform user identifiers of the recipient.

type

CommunicationMessageType

The type of message. Supports text, image, template.