How to use IFTTT with Raspberry Pi
IFTTT stands for IF This Then That, and is a free web service that allows users to build their own custom applets. In this article, you'll learn how to build a custom applet that you can use with the Raspberry Pi, including how to connect to IFTTT, set up the internal Webhook, and how to enable it.
This can be used for a lot of projects and applications, but for the purposes of this article, the goal is to build an applet that sends notifications to the phone when motion is detected.
Hardware requirements
- Raspberry Pi with operating system installed on SD card (available on official website)
- Power cable
- Screen
- HDMI connector
- USB or Bluetooth mouse
- USB or Bluetooth keyboard
- WiFi or Ethernet connection
Set up IFTTT account and take action
1. Create an account
To create an IFTTT account, open the website here.
On this page, sign up through certain options or click Sign Up to create an account.
2. Create an action
To create an action, click the Profile option in the top right corner to open the drop-down list.
On the list, click Create.
3. Create a trigger
When you click Create , a page similar to the following opens:
On this page, click + This .
4. Select service
The article will use the Webhook service for the trigger and choose the option named Webhooks from the list provided.
After selecting Webhooks, click the Connect button .
5. Select the trigger
Some services offer more than one type of trigger, but Webhooks only provides one option.
Click the option box that appears, as shown in the image above.
6. Assign the event name
The trigger will only be fired if an event is true. Therefore, you need to assign the Event name to the trigger.
The name cannot contain any spaces or special characters, except the underscore _.
7. Create an action
Now, you have to choose the action service, to do this, first click + That on the page.
8. Select an action service
As discussed, you want a notification to be sent to the phone when motion is detected, that is when the event is true, the action will be a notification. Therefore, choose a notification from the list provided.
Then, press the Connect button to see the action provided.
9. Choice of action
Since you want to just send a simple notification to your phone, select the option Send a notification from the IFTTT app.
10. Write the message you want to send
IFTTT notifications are customized so you can write the content you want to see in it. After you clicked on the blue option box in the previous step, you will see a message option open, where you can enter the text you want, then click the Create action button .
11. Find the API key
The Webhooks page will open by itself, otherwise double-click the icon. On this page, click Documentation (in the right corner).
12. Copy the keys
When you open this page, the first line is the API Key.
The URL you must send the Webhook call to is specified below Make a POST or GET web request to .
Use IFTTT from Raspberry Pi
Make sure to update and upgrade the software before starting. The article also assumes that you have installed Python on a Pi with code for the project, in this case a motion detector.
Step 1. Install the Python requests module:
sudo pip install requests
Step 2. Modify the code to include the following statements at the beginning:
import time import requests
Step 3. At the bottom of the script, add the following line:
request.post requests.post('https://maker.ifttt.com/trigger/event name/with/key/apikey')
In the line above, make sure to replace event name and apikey with the name you typed and found respectively.
Step 4. Install the IFTTT app on your smartphone:
You must download the IFTTT app for Android | IFTTT for iOS.
Step 5. Save and run Python code on Raspberry Pi
When the event, here motion detection, is true, you'll get a notification on your smartphone.
You should read it
- Use IFTTT to not miss an important phone when you forget to turn on the bell
- How to add an ADC to Raspberry Pi: What you need to know
- Raspberry Pi Zero vs Model A and B, how are they different?
- YouTube Live will support IFTTT, geotagging and many new improvements
- What is the Raspberry Pi and how is the Raspberry Pi used?
- How to start Raspberry Pi 3 from USB
- Why should people try Raspberry Pi 4?
- How to schedule sending SMS on Android
- Learn Pi Imager, How to Use Raspberry Pi Imager
- How to use Raspberry Pi Imager to install Raspberry Pi OS
- 5 ways to make good use of Raspberry Pi 4
- How to send an SMS to save the website to Google Drive
Maybe you are interested
How to use Auto Clicker Assist to automatically click the mouse
Instructions to fix double click error on computer mouse - Click once becomes twice
PowerToys will soon support creating app spaces and launching with just one click
Turn Windows 11 interface into Windows 10 with just one click
Fix right-click issue on Windows 10
Do not click on strange links or your phone will be hijacked