Now that your Pi is making prediction on package deliveries, let's set up some alerts!

Set up an IFTTT Applet

Go to IFTTT and log in (or create an account).

Once you are logged in, click Create in the top right corner to create a new Applet.

Click the Add button on the If This block.

Search for and select Webhooks.

Set the Event Name trigger to package, and click on Create trigger.

This will trigger an action when the ML model label is "package". 

If you are using a different ML model label than "package", be sure to change the Event Name trigger!

Next, click the Add button on the Then That block.

Search for and select Email.

If this is the first time you're setting up an e-mail applet in IFTTT, you'll need to verify your e-mail.

Edit the subject line and body text of the email notification. This is the email you'll see for each package notification. The items highlighted in gray are dynamic elements that are generated when the event runs.

Finally give your applet a name and click Finish.

Your email notification applet is now ready to go!

Setup Webhook Key

We're using a webhook to trigger the email notification.  The webhook has a unique key, so only you can trigger the event. We're going to get the key from IFTTT and set it as an environment variable on the Pi. 

From your profile menu in the top right, select My services.

Next, select Webhooks.

From the Webhooks screen, select Documentation in the top right.

Copy the key from the top of the page.

Remember to treat the key like a password

Open an SSH connection to the Pi. Create a new environment variable called IFTTTKEY.

Use the following command in terminal, replacing PASTE-KEY-HERE with your IFTTT key:

export IFTTTKEY=PASTE-KEY-HERE

Start the program again

Finally, restart the lobe-package-detector.py program and you're all set to go!

This guide was first published on Mar 30, 2021. It was last updated on 2021-03-30 15:53:33 -0400.

This page (Set up E-mail Alerts) was last updated on Apr 22, 2021.

Text editor powered by tinymce.