Why Not? Automating Coffee Break Notifications with Azure Logic Apps

Let’s face it, folks: productivity peaks when caffeine flows. But how often do you lose track of time, only to realize you’ve been glued to your screen without your essential coffee break? Enter Azure Logic Apps, your caffeine accountability buddy.

Yes, we’re automating coffee break reminders. Is it silly? Absolutely. Is it also a fantastic way to show off your Logic Apps skills? You betcha. Let’s build it—with full code, because you deserve it.

The Plan

Here’s what we’re building:

  1. Trigger: The Logic App runs every workday at a specific time.
  2. Check Your Calendar: Ensure you’re not in a meeting during coffee time.
  3. Send a Reminder: Notify yourself to take a break and caffeinate responsibly.

Create the Logic App

First, create a Logic App in the Azure Portal (Consumption Plan) and name it something clever like CoffeeBreakBuddy. We are building a caffeine ally here afterall.


Full Code: Coffee Break Reminder Logic App

Here’s the complete code for your new caffeine buddy in JSON. Save it as a .json file and import it into the Azure Logic Apps designer

{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Check_Calendar": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['office365']['connectionId']"
}
},
"method": "get",
"path": "/v2/calendars/me/events",
"queries": {
"$filter": "start/dateTime ge '@{utcNow()}' and start/dateTime lt '@{addMinutes(utcNow(),30)}'"
}
},
"runAfter": {
"Recurrence": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"Condition": {
"actions": {
"Send_Reminder": {
"inputs": {
"body": {
"Content": "It's coffee o'clock! Take a break and enjoy your brew. ☕"
},
"host": {
"connection": {
"name": "@parameters('$connections')['office365']['connectionId']"
}
},
"method": "post",
"path": "/v2/emails",
"headers": {
"Subject": "Coffee Break Reminder"
}
},
"type": "ApiConnection"
}
},
"expression": {
"and": [
{
"equals": [
"@empty(body('Check_Calendar')?['value'])",
true
]
}
]
},
"runAfter": {
"Check_Calendar": [
"Succeeded"
]
},
"type": "If"
}
},
"triggers": {
"Recurrence": {
"recurrence": {
"frequency": "Day",
"interval": 1,
"schedule": {
"hours": [
10
],
"minutes": [
0
]
}
},
"type": "Recurrence"
}
}
},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
}
}

How It Works

Trigger: Recurrence

  • Runs every day at 10:00 AM. Adjust the time in the schedule property under Recurrence.

Check Your Calendar

  • Uses the Office 365 Outlook connector to check for events in the next 30 minutes.

Condition: Is It Coffee Time?

  • If your calendar is empty during the coffee break window, it sends a reminder.
  • If busy, skips the reminder because productivity comes first (sometimes).

Send Reminder

  • Sends an email through the Office 365 connector. You can change this to a Teams message or even a text with Twilio.

How to Deploy

  1. Import the JSON:
    • In the Logic Apps designer, click Import Logic App and upload the JSON file.
  2. Set Up Connections:
    • Add an Office 365 Outlook connection for email and calendar integration.
  3. Save and Run:
    • Save your Logic App and test it by running it manually or waiting for the next scheduled run.

Bonus Ideas

  • Add weather data to suggest iced or hot coffee.
  • Hook up Spotify to start a “Coffee Break” playlist.
  • Track your breaks in Azure Table Storage to analyze your caffeine habits.

Now go forth and caffeinate like a boss. And remember, this isn’t just about coffee—it’s about showing the world that no problem is too small to automate. Cheers!