Send Message to Azure IoT
- This topic has 2 replies, 2 voices, and was last updated 8 years ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Home › Forums › Conduit: AEP Model › Send Message to Azure IoT
Tagged: Azure IoT
Hi,
I am trying to send a message to Azure IoT using the Resource.
From other resources I understand the structure of an Azure payload for the function node should be:-
{
“protocol”: “amqp”,
“deviceId”: “<your device id>”,
“key”:”<your device key>”,
“data”:”<your json data>”
}
I am not sure where the other entries (the http end point, shared key etc) should go. These are usually handled in the form of a connection string in the Azure nodes. But I am not sure where to put these.
Any guidance?
To directly use a connection string, in the msg.payload you can set a connectionString field:
{
“protocol”: “amqp”,
“deviceId”: “your device id”,
“key”:”your device key”,
“data”:”your json data”
“connectionString”:”your connection string”
}
Alternatively you can include all this information in a javascript function, for example:
var azuremsg = {};
azuremsg.topic = "devices/" +
"your device id" +
"/messages/events/";
azuremsg.payload = {};
azuremsg.payload.protocol = "amqp";
azuremsg.payload.deviceId = "insert device id";
azuremsg.payload.key = "insert key";
azuremsg.payload.hostname = "insert hostname";
azuremsg.payload.data = "data to send goes here";
return azuremsg;