Cloud to Device Messaging Azure IoT Hub

I am new to Azure IoT Hub and I am looking to receive messages from Azure IoT Hub. I am currently using the Azure IoT integration in the Particle Cloud however, I can’t seem to find any good information on how to receive direct method messages from Azure. Is there any way I can do this? Any help will be great!

Hi @jk123 and welcome to the community!

A few days ago someone asked a similar question, just for another Cloud provider.
Would you like to have a read?

Keep asking if not clear enough.

Hi Gustavo,

Thank you for sending this over! If I am reading this right, I need to call the particle function in my backend application. Would I still need to use MQTT? I have also heard of using logic apps and function apps in Azure, but I’m unsure how to trigger the functions from my backend web app.

Thank you,

no, calling a Particle cloud function requires an https request.

Your backend web app can call the Azure function with an https request like this diagram below:

Each function has its own URL. Remember that in the function you would likely authenticate the user that is calling it.

Got more questions? Keep asking please,

1 Like

Hey Gustavo,

Thank you for your help! I am still a little confused. On the Azure page for direct methods it says that you can either use MQTT or AMQP. The above method you proposed seams to forgo that, unless I am missing something. I also have seen the ability to use the ParticleJS library to use Node.js, which according to this link, Quickstart - Control a device from Azure IoT Hub | Microsoft Docs, can connect to Azure through direct methods. Is this not true for the boron or other devices?

Appreciate the help!

Hey JK,

have you seen the Particle Azure integration? (not 100% sure from your first post, sorry for asking).

That integration is one way, as stated here:

What the document you linked explains is for a simulated device. I read it, but could not make the link to Particle, so apologies for that. I could not find the MQTT or AMQP references either. Perhaps it's in another doc or I read it too quick.

The method I describe is one way of doing things with Azure. I'm pretty sure there are other viable ways that I never contemplated.

Azure functions support JS and node.js I believe, so having some code running in one such function, that is using the ParticleJS lib, would be one way to go.
Another way to go is to code a plain Azure cloud function is JS, or C# if you were more familiar, that will send an https request to the particle cloud.

Better, not better?

thanks for the awesome information.

1 Like

thanks my issue has been fixed.

1 Like