Send Message to Azure IoT

Home Forums Conduit: AEP Model Send Message to Azure IoT

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #19685
    John O’Gorman
    Participant

    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?

    #19872
    Peter Ferland
    Blocked

    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”
    }

    • This reply was modified 7 years, 4 months ago by Peter Ferland. Reason: unrestricted html screwed up tags
    #19874
    Peter Ferland
    Blocked

    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;
    
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.