Main Content

Publish to a Channel Feed

Publish message to update multiple channel fields simultaneously




channels/<channelID>/publish/<apikey> publishes messages to the topic to update a channel feed. Replace <channelID> with the channel ID and <apikey> with the Write API Key of the channel. To learn more about configuring your channel, see Channel Properties. To update multiple parameters simultaneously, see Payload Parameters.

  • Add any necessary Payload Parameters.

  • Set the PUBLISH messages to have a QoS value of 0.

  • Set the connection RETAIN flag to 0.

  • Set the connection CleanSession flag to 1.

To learn more about these flags, see MQTT v3.1.1 specification.

Input Arguments

expand all

Channel ID for the publish target, specified as a numeric.

Data Types: uint16 | int16 | int8 | uint8

Channel write API Key. The value can be found on Channel Settings > API Keys. This value is different than the MQTT API Key used for connection, and it is different than the channel Read API Key

Data Types: char

Payload Parameters

Specify the optional payload parameters for the PUBLISH message as Name=Value arguments, separated using & as a string. For example: field1=100&field2=50&lat=30.61&long=40.35 If the parameter definition string contains any special characters, it must be URL (percent) encoded (application/x-www-form-urlencoded).


Data to be entered in field 1 of a channel.

For example: field1=100


Data to be entered in field x of a channel. Make sure the field is enabled in the channel settings.

For example: fieldx=100

x must be less than or equal to 8, the number of allowed fields.


Location of your channel in the form of latitude.

For example: lat=10.45


Location of your channel in the form of longitude.

For example: long=35.4


Elevation of your channel from the ground level in meters.

For example: elevation=100


Status message of your channel.

For example: status=Message


User name of your Twitter® account that is linked to ThingTweet app.

For example: twitter=nohans


Status message update of your Twitter account.

For example: tweet=Tweet from my channel


Date of feed entry in ISO 8601 format.

For example: created_at=2014-12-31 23:59:59


Configure MQTT.fx to send a PUBLISH message to update a channel feed.

Replace <channelID> with the channel ID and <apikey> with the Write API Key of the channel. This PUBLISH message publishes a value of 45 to field1 and 60 to field2 of the specified channel, along with a status message MQTTPUBLISH.