Skip to content

Publish outbound messages

To publish outbound messages:

  1. Subscribe to the outbound topic devices/{clientId}/messages/devicebound/# in the device.

  2. Publish outbound messages using the Outbound messages API. Expiry can be set for each outbound message.

    Query Params:

    DeliveryFormat=json (default)

    RequestBody: Content-Type: application/json

    **Sample request - json**
    {
     "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
     "payload": {
         "latitute": 11.4238,
         "longitude": 143.2179
     },
     "properties": {
         "battery_on": false,
         "fuel_level": 847
     }
     }

    Query Params:

    DeliveryFormat=raw

    RequestBody: Content-Type: application/json

    **Sample request - raw**
    {
     "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
     "payload": "VGVzdEAxMjM=",
     "properties": {
         "battery_on": false,
         "fuel_level": 847
     }
     }

    Query Params:

    DeliveryFormat=text

    RequestBody: Content-Type: application/json

    **Sample request - text**
    {
     "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
     "payload": "Hello World",
     "properties": {
         "battery_on": false,
         "fuel_level": 847
     }
     }
  1. The device will receive the message in the below topic with application properties set in the request and other system properties appended to the topic.

     devices/{clientId}/messages/devicebound/%24.exp=2023-03-10T11%3A31%3A49.3830000Z&%24.mid=b9c829d2-66e4-4302-b55e-8bc666c3d173&%24.to=%2Fdevices%2F{clientId}%2Fmessages%2FdeviceBound&iothub-ack=full&battery_on=True&fuel_level=15
  2. Feedback status of the outbound message can be monitored using Get Outbound Message Status API. The feedback status can also be consumed from the lifecycle delivery endpoint.