This commit is contained in:
nusquama
2025-11-20 09:17:27 +01:00
parent 2a6e424070
commit 43cfc64aa9
@@ -0,0 +1,282 @@
Automate Daily Google Calendar Events to Trello Cards
https://n8nworkflows.xyz/workflows/automate-daily-google-calendar-events-to-trello-cards-10723
# Automate Daily Google Calendar Events to Trello Cards
### 1. Workflow Overview
This workflow automates the daily transfer of Google Calendar events into Trello cards, ideal for professionals managing their tasks across these two platforms. It is designed to run every morning at 8 AM and performs the following logical blocks:
- **1.1 Trigger and Date Calculation:** Automatically triggers the workflow daily and calculates the start and end timestamps for the current day.
- **1.2 Fetch and Batch Process Calendar Events:** Retrieves all Google Calendar events for the day and splits them into individual batches for processing.
- **1.3 Event Data Extraction and Filtering:** Extracts relevant event details formatted for Trello cards and filters out predefined routine events (e.g., lunch breaks).
- **1.4 Trello Card Creation or Event Skip:** For each filtered event, creates a Trello card using a meeting notes template; skips routine events.
---
### 2. Block-by-Block Analysis
#### 1.1 Trigger and Date Calculation
- **Overview:**
Initiates the workflow every day at 8 AM and calculates the current day's date range (from 00:00 to 23:59:59) to use as filters for event fetching.
- **Nodes Involved:**
- Run Daily at 8 AM (Cron)
- Calculate Today's Date Range (Function)
- **Node Details:**
- **Run Daily at 8 AM**
- Type: Cron Trigger
- Configuration: Triggers once daily at 08:00 hours.
- Inputs: None (trigger node)
- Outputs: Connected to Calculate Today's Date Range node.
- Edge Cases: Cron misconfiguration can delay or prevent workflow start.
- **Calculate Today's Date Range**
- Type: Function
- Configuration: Calculates ISO string timestamps for start of day (00:00) and end of day (23:59:59.999). Adds a `myVariable` set to 1 (likely placeholder or for future extension).
- Key Expressions: Uses JavaScript `Date` object to compute date range dynamically.
- Inputs: Trigger from Cron node
- Outputs: Passes `from` and `to` ISO strings for filtering calendar events.
- Edge Cases: Timezone differences could cause off-by-one errors if server timezone differs from calendar timezone.
---
#### 1.2 Fetch and Batch Process Calendar Events
- **Overview:**
Retrieves all Google Calendar events within the computed date range and splits them into individual event batches for sequential processing.
- **Nodes Involved:**
- Fetch All Today's Calendar Events (Google Calendar)
- Process Events One by One (SplitInBatches)
- **Node Details:**
- **Fetch All Today's Calendar Events**
- Type: Google Calendar
- Operation: `getAll`
- Configuration: Uses `timeMin` and `timeMax` from previous node to fetch events only for today; `singleEvents` enabled to expand recurring events into instances.
- Key Expressions: `timeMin` = `{{ $node["Calculate Today's Date Range"].json["from"] }}`, `timeMax` = `{{ $node["Calculate Today's Date Range"].json["to"] }}`
- Inputs: From Calculate Today's Date Range node
- Outputs: Array of event objects
- Edge Cases: Authentication failures, API rate limits, or empty event lists.
- **Process Events One by One**
- Type: SplitInBatches
- Configuration: Batch size set to 1 to process each event individually to allow for granular handling and filtering.
- Inputs: All events fetched from the Google Calendar node.
- Outputs: Single event per execution path downstream.
- Edge Cases: Large number of events could increase processing time.
---
#### 1.3 Event Data Extraction and Filtering
- **Overview:**
Extracts relevant event properties needed to create Trello cards and filters out routine or recurring events that should not generate cards.
- **Nodes Involved:**
- Extract Event Details for Trello (Set)
- Filter Out Routine Events (IF)
- **Node Details:**
- **Extract Event Details for Trello**
- Type: Set
- Configuration: Maps event properties from the batch item to simplified Trello card fields:
- `name` from event `summary`
- `description` from event `description`
- `duedate` from event `start.dateTime`
- `URL` from event `htmlLink`
- Key Expressions: Uses expressions like `{{$node["Split Events In Batches"].json["summary"]}}`.
- Inputs: Single event from Process Events One by One node.
- Outputs: Structured event data for filtering and Trello card creation.
- Edge Cases: Missing event fields (e.g., no description or start time) could cause null values.
- **Filter Out Routine Events**
- Type: IF
- Configuration: Checks event `summary` against a list of routine event names (`Check email and start day`, `Lunch`, `Wrap Up & Clear Desk`, `Beers and Griping`). If any match, event is filtered out (goes to skip).
- Inputs: Event details from Set node.
- Outputs:
- True branch: Events matching routine names → Skip Filtered Event node
- False branch: All other events → Create New Trello Card node
- Edge Cases: Event summary casing or spelling variations could bypass filter unintentionally. Customization required to adapt to user-specific routine events.
---
#### 1.4 Trello Card Creation or Event Skip
- **Overview:**
Creates Trello cards for valid events using a structured meeting notes template or skips routine events.
- **Nodes Involved:**
- Skip Filtered Event (NoOp)
- Create New Trello Card with Template (Trello)
- **Node Details:**
- **Skip Filtered Event**
- Type: NoOp (No Operation)
- Configuration: Placeholder node to explicitly handle filtered-out events with no action.
- Inputs: Events routed here by filter node for routine events.
- Outputs: None (terminal)
- Edge Cases: None; acts as logical end for filtered events.
- **Create New Trello Card with Template**
- Type: Trello
- Configuration:
- Card name: from event name
- Description: Predefined meeting notes template with placeholders for meeting purpose, next steps, decisions, and discussion items (static content).
- Due date: from event start dateTime
- Labels: empty by default; customizable via `idLabels` field
- URL source: taken from environment variable `BASE_URL` (likely for card attachment or reference)
- Trello board and list IDs to be configured by user (not shown in JSON, assumed to be set in credentials or additionalFields)
- Inputs: Event details from Filter Out Routine Events node (false branch)
- Outputs: Newly created Trello card confirmation
- Edge Cases: Trello API authentication errors, missing or incorrect board/list IDs, invalid due date formats, rate limits.
---
### 3. Summary Table
| Node Name | Node Type | Functional Role | Input Node(s) | Output Node(s) | Sticky Note |
|-------------------------------|---------------------|---------------------------------------|----------------------------------|---------------------------------------|-------------------------------------------------------------------------------------------------------|
| Run Daily at 8 AM | Cron | Triggers workflow daily at 8 AM | None | Calculate Today's Date Range | ## ⏰ Trigger & Date Setup: Run daily at 8 AM; Change hour in Cron node to adjust trigger time |
| Calculate Today's Date Range | Function | Calculates today's date range | Run Daily at 8 AM | Fetch All Today's Calendar Events | ## ⏰ Trigger & Date Setup: Generates today's 00:00 to 23:59 time window for API |
| Fetch All Today's Calendar Events | Google Calendar | Fetches all calendar events today | Calculate Today's Date Range | Process Events One by One | ## 📅 Fetch & Process Events: Replace `your-email@example.com` with your calendar email |
| Process Events One by One | SplitInBatches | Splits events to process individually | Fetch All Today's Calendar Events | Extract Event Details for Trello | ## 📅 Fetch & Process Events: Processes events one by one |
| Extract Event Details for Trello | Set | Maps event data for Trello card | Process Events One by One | Filter Out Routine Events | ## 🔄 Extract & Filter: Maps event data; edit filter conditions to match your routine event names |
| Filter Out Routine Events | IF | Filters routine events to skip | Extract Event Details for Trello | Skip Filtered Event (true branch), Create New Trello Card with Template (false branch) | ## 🔄 Extract & Filter: Skips daily recurring tasks like "Lunch" or "Check email" |
| Skip Filtered Event | NoOp | Handles filtered events (no action) | Filter Out Routine Events (true) | None | ## ✅ Create or Skip: Handles filtered events (no action) |
| Create New Trello Card with Template | Trello | Creates Trello cards for events | Filter Out Routine Events (false) | None | ## ✅ Create or Skip: Configure Trello board/list IDs in Create node; uses meeting notes template |
| Workflow Documentation | Sticky Note | Documentation and instructions | None | None | ## 🗓️ Automate Daily Google Calendar Events to Trello Cards: Setup instructions, use cases, requirements |
| Step 1-2 | Sticky Note | Trigger & Date Setup description | None | None | ## ⏰ Trigger & Date Setup |
| Step 3-4 | Sticky Note | Fetch & Process Events description | None | None | ## 📅 Fetch & Process Events |
| Step 5-6 | Sticky Note | Extract & Filter description | None | None | ## 🔄 Extract & Filter |
| Step 7-8 | Sticky Note | Create or Skip description | None | None | ## ✅ Create or Skip |
---
### 4. Reproducing the Workflow from Scratch
1. **Create Cron Node**
- Name: `Run Daily at 8 AM`
- Type: Cron
- Parameters: Set trigger time to 8:00 AM daily (hour: 8)
- No credentials needed.
2. **Create Function Node**
- Name: `Calculate Today's Date Range`
- Type: Function
- Parameters:
```javascript
const curr = new Date();
const start = new Date(curr.setHours(0, 0, 0, 0));
const end = new Date(curr.setHours(23, 59, 59, 999));
items[0].json.from = start.toISOString();
items[0].json.to = end.toISOString();
items[0].json.myVariable = 1;
return items;
```
- Connect output of Cron node to this node.
3. **Create Google Calendar Node**
- Name: `Fetch All Today's Calendar Events`
- Type: Google Calendar
- Operation: `getAll`
- Parameters:
- Calendar: Set to your Google Calendar email (replace `your-email@example.com`)
- Options:
- `timeMin`: `={{$node["Calculate Today's Date Range"].json["from"]}}`
- `timeMax`: `={{$node["Calculate Today's Date Range"].json["to"]}}`
- `singleEvents`: true (to expand recurring events)
- Credentials: Configure Google OAuth2 credentials with Calendar API scope.
- Connect output of Function node to this node.
4. **Create SplitInBatches Node**
- Name: `Process Events One by One`
- Type: SplitInBatches
- Parameters:
- Batch Size: 1
- Connect output of Google Calendar node to this node.
5. **Create Set Node**
- Name: `Extract Event Details for Trello`
- Type: Set
- Parameters: Add fields (all string type):
- `name`: `={{$node["Process Events One by One"].json["summary"]}}`
- `description`: `={{$node["Process Events One by One"].json["description"]}}`
- `duedate`: `={{$node["Process Events One by One"].json["start"]["dateTime"]}}`
- `URL`: `={{$node["Process Events One by One"].json["htmlLink"]}}`
- Connect output of SplitInBatches node to this node.
6. **Create IF Node**
- Name: `Filter Out Routine Events`
- Type: IF
- Parameters:
- Conditions (string, combine with OR):
- `={{$node["Extract Event Details for Trello"].json["name"]}}` equals `Check email and start day`
- `={{$node["Extract Event Details for Trello"].json["name"]}}` equals `Lunch`
- `={{$node["Extract Event Details for Trello"].json["name"]}}` equals `Wrap Up & Clear Desk`
- `={{$node["Extract Event Details for Trello"].json["name"]}}` equals `Beers and Griping`
- Connect output of Set node to this node.
7. **Create NoOp Node**
- Name: `Skip Filtered Event`
- Type: NoOp
- Connect IF node **true** branch (filtered routine events) to this node.
8. **Create Trello Node**
- Name: `Create New Trello Card with Template`
- Type: Trello
- Parameters:
- Name: `={{$node["Extract Event Details for Trello"].json["name"]}}`
- Description (static template):
```
**Meeting purpose (*Integrations, Playbooks, UI Issues, Project*):**
- Task
**Next Steps (*Task, Assigned to, Checkpoint Date*):**
- Task
**Decisions Made: (*What, Why, Impacts*):**
- Task
**Discussion: (*Items/Knowledge Shared*):**
- Task
```
- Additional Fields:
- Due date: `={{$node["Extract Event Details for Trello"].json["duedate"]}}`
- idLabels: leave empty or customize with label IDs
- urlSource: `={{ $env.BASE_URL }}` (set this env var in your n8n instance)
- Credentials: Set Trello API credentials with access to your board and list.
- Configure the board and list IDs in the node settings (not shown in JSON but required).
- Connect IF node **false** branch (non-routine events) to this node.
---
### 5. General Notes & Resources
| Note Content | Context or Link |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|
| This workflow is ideal for professionals who want to automate task creation from calendar events, such as project managers or team leads. | Workflow Documentation sticky note in the workflow |
| Customize the list of filtered routine event names in the IF node to match your recurring meetings or breaks. | Filter Out Routine Events node |
| Replace placeholder email `your-email@example.com` with your actual Google Calendar email address. | Fetch All Today's Calendar Events node |
| Configure Trello board and list IDs in the Trello node to ensure cards land in the correct location. | Create New Trello Card with Template node |
| The environment variable `BASE_URL` can be set in n8n to link back to your application or documentation within Trello cards. | Create New Trello Card with Template node |
| For troubleshooting, verify Google OAuth2 credentials and Trello API tokens have sufficient permissions and are valid. | General integration guidance |
| Video or external tutorials for setting up Google Calendar and Trello integrations with n8n can be found on the official n8n documentation site. | https://docs.n8n.io/integrations/builtin/nodes/n8n-nodes-base.googlecalendar/ and https://trello.com/developer/api |
| Adjust the Cron node trigger time to suit different time zones or schedules. | Run Daily at 8 AM node |
---
**Disclaimer:** The text provided is exclusively derived from an automated workflow created with n8n, a tool for integration and automation. This processing strictly complies with current content policies and contains no illegal, offensive, or protected elements. All data handled is legal and public.