latestOpenAPI 3.0.12026-08-192092911.2 MB

916e669fc527

Messages

Send a message to a single recipient

Sends a message to a single recipient. Supported recipient types: device, resourceGroup, webUser, resourceGroupMobile, resourceMobile, userMobile, userEmail, email, mobileNumber. (required scope messages:write)

post/v1/messages

Headers

Customer-Idinteger required

The customer identifier

Request body

recipientType'device' | 'resourceGroup' | 'webUser' | 'resourceGroupMobile' | 'resourceMobile' | 'userMobile' | 'userEmail' | 'email' | 'mobileNumber' required

The type of recipient for a message.<p>Possible values:</p><ul><li><b>device</b>: A tracked device assigned to a resource</li><li><b>resourceGroup</b>: A resource group (all devices in the group)</li><li><b>webUser</b>: A web user</li><li><b>resourceGroupMobile</b>: A resource group (SMS to all mobiles in the group)</li><li><b>resourceMobile</b>: A resource — sends SMS to the resource's mobile number</li><li><b>userMobile</b>: A web user — sends SMS to the user's mobile number</li><li><b>userEmail</b>: A web user — sends an email to the user's email address</li><li><b>email</b>: An arbitrary email address supplied in</li><li><b>mobileNumber</b>: An arbitrary mobile number supplied in</li></ul>

recipientIdinteger nullable

The unique identifier of the recipient.<br/>Required for entity-based recipient types: device, resourceGroup, webUser, resourceGroupMobile, resourceMobile, userMobile, userEmail

recipientAddressstring nullable

The recipient address.<br/>Required for address-based recipient types: email (supply a valid email address), mobileNumber (supply a number in international format, e.g. +44 7777 123456)

bodystring

The message body. Maximum 1000 characters

subjectstring nullable

The message subject. Maximum 50 characters. Optional — ignored for SMS recipient types (resourceMobile, userMobile, resourceGroupMobile)

Example request

{
  "recipientType": "device"
}

Response

Created

messageIdinteger

The unique identifier for the sent message

statusstring

The delivery status of the message. Possible values: queued, sent, failed

sentAtstring date-time

The UTC timestamp at which the message was sent