Jump toSuggest an edit

Triggering IFTTT actions from IoT Hub messages

Reviewed on 16 October 2023Published on 04 January 2021
  • Scaleway
  • IoT-Hub

Quick & easy application creation with IoT Hub and IFTTT

IFTTT stands for “If This, then That”. It is an easy to use yet powerful automation service where you can choose to perform an action upon an event. There are thousands of events and actions available and customizable. This is awesome.

In this article we will show you how to quickly build a simple reporting application which stores your devices’ data in a Google sheet.

Security & Identity (IAM)

To perform certain actions described below, you must either be the Owner of the Organization in which the actions will be performed or an IAM user with the necessary permissions.

Create an IFTTT account and set up an applet

  1. Sign up to IFTTT. When done click the create button to start building your applet.
  2. Choose Webhooks: Receive a web request as the “If This” trigger. Type in iot_event as the event name and create the trigger.
  3. Choose Google Sheets: Add row to spreadsheet as the “Then That” action. We will use default settings, just create the action without changing them.
  4. Click the continue button
  5. Choose a title, such as Scaleway IoT Hub to Google Sheet as your applet name and click Finish. You’re done with the applet.

Now the applet is set up, we need to find our webhook key, head to your webhook settings, you will find there a URL like<key>. Write down the key part, we will use it later.

Creating an IoT Hub and setting up the IoT Route

Now that we have our IFTTT applet ready, we need to create an IoT Hub. This will be where our simulated IoT Device will publish messages to trigger our IFTTT applet.

  1. Follow this procedure to create an IoT Hub. Select your name and plan of choice, and click the Create Hub button.

  2. Head to the Routes tab of your IoT Hub.

  3. Create a new route with the following settings:

    • Name: anything you’d like (ex: IFTTT Route)
    • Topic: This will be the topic to publish to from your Device, let’s use my/data
    • Route type: REST Query
    • Verb: POST
    • Endpoint:<key> where <key> is the key you got from IFTTT earlier.
    • HTTP Headers: Content-Type: application/json

Now that we have everything set up, let’s add a Device and send a message from there.

Adding a Device a triggering the IFTTT applet

In your Scaleway console, head to the Devices tab of your IoT Hub. From there, to add a new Device, give it any name and pick the Allow insecure connection option (you do not want to do that in production, but this is fine for this tutorial’s purpose). Click the Add button, and, finally, the Close button.

Now your Device appears in the Device list, click it and then on the MQTT Webclient button to simulate a real device.

In the Topic field write my/data (which is the topic we chose for the IoT Route). In the Message field write { "value1" : "Hi", "value2" : "from", "value3" : "Scaleway!" }. Then click the Publish button (no confirmation will be issued).

The message published on my/data topic will be received by the IoT Route and forwarded to the IFTTT Webhook trigger, which will save the values in the Google sheet.

Now head to your Google sheet home page, open the IFTTT_Maker_Webhooks_Events spreadsheet, and voila. You can even see data flowing in live when publishing more messages.

All done

We hope you had fun collecting data from your IoT Hub to a Google sheet. This is one of the many possibilities the IoT Hub REST Route provides. Stay tuned for more REST Route usage examples.

Learn more about Scaleway IoT Hub, discover how to add Devices to the hub or check out the IoT Hub metrics.

Cloud Products & Resources
  • Scaleway Console
  • Compute
  • Storage
  • Network
  • IoT
  • AI
Dedicated Products & Resources
  • Dedibox Console
  • Dedibox Servers
  • Network
  • Web Hosting
  • Blog
  • Careers
  • Scaleway Learning
Follow us
ContractsLegal NoticePrivacy PolicyCookie PolicyDocumentation license
© 1999-2024 – Scaleway SAS