Schedule and Cancel Notifications with the API

If you want notifications when a door or a window has been left open for a period of time, or to learn how to use the Pushcut API then this guide is for you!

Step 1: Create a new Pushcut notification

Add a new notification in the Pushcut app.

Set a name and enter a title and a message.

Step 2: Create an API Key

In the app under the Account tab, scroll to Integrations and tap Add API Key. Set the name to HomeKit and then tap Generate.

Step 3: Create the first HomeKit automation

  1. In HomeKit use the + icon to create a new automation.
  2. Set the trigger to when your door opens.
  3. Select Convert to Shortcut instead of a scene (under Advanced at the bottom).
  4. Delete the Set Scenes and Accessories action.
  5. Add the URL action and paste in the webhook URL of your notification (from Step 1).
  6. Add the Get Contents of URL action and make sure the URL parameter is set.
  7. Tap on the > to expand the Get Contents of URL action, and change the method from GET to POST.
    • Add a new field: set the type to Text, the key to identifier and the value to door_open.
    • Add another new field: set the type to Text, the key to delay and the value to 10m.
  8. Tap Next and Done.

Step 4: Create the second HomeKit automation

  1. In HomeKit use the + icon to create a new automation.
  2. Set the trigger to when your door closes.
  3. Select Convert to Shortcut instead of a scene (under Advanced at the bottom).
  4. Delete the Set Scenes and Accessories action.
  5. Add the URL action and paste in https://api.pushcut.io/v1/submittedNotifications/door_open. (The door_open part at the end is the identifier you set earlier).
  6. Add the Get Contents of URL action and make sure the URL parameter is set.
  7. Tap on the > to expand the Get Contents of URL action, and change the method from GET to DELETE.
    • Add a new header: set the key to API-Key and the value to the API Key from Step 2.

Step 5: Relax and enjoy!

That's it, you are all set! Now whenever your door opens a new notification will be scheduled for in 10 minutes time. If your door closes before the 10 minutes are up it will be cancelled, but otherwise you'll be notified! And the best part: when the door is then closed the notification will disappear.

You could also use this to schedule a server action (using the same delay parameter), and send yourself a notification allowing you to cancel it.