locked
How to trigger notification hub from IoT hub RRS feed

  • Question

  • Hi!

    I've been trying for hours to find some documentation on this but I can't seem to find anything!

    I have a device connected to the IoT hub and I have notification working on the Notification hub.

    But how can I connect these two?

    I'm thinking of Functions, but I cant find any up to date documentation on how to do this

    Thank you very much!

    Saturday, January 25, 2020 4:44 PM

Answers

  • It works! I figured it out using Azure functions v1.

    I first got it to work using the HTTP trigger template in the azure portal, then in the 'intergrate' tab set the notification hub as output.

    Then to trigger a notification you can use this code(anywhere in the index.js you'd like):

    context.bindings.notification = { message: "Message!"};

    If anyone has questions feel free to ask!

    • Marked as answer by Berend The Sunday, January 26, 2020 8:27 PM
    Sunday, January 26, 2020 8:27 PM

All replies

  • It works! I figured it out using Azure functions v1.

    I first got it to work using the HTTP trigger template in the azure portal, then in the 'intergrate' tab set the notification hub as output.

    Then to trigger a notification you can use this code(anywhere in the index.js you'd like):

    context.bindings.notification = { message: "Message!"};

    If anyone has questions feel free to ask!

    • Marked as answer by Berend The Sunday, January 26, 2020 8:27 PM
    Sunday, January 26, 2020 8:27 PM
  • Glad to hear that you have figured out. Appreciate for sharing the steps.

    There are documentations available in case if you haven’t checked, please refer Azure IoT Hub bindings for Azure Functions and Notification Hubs output binding for Azure Functions

    Monday, January 27, 2020 4:53 AM