@marek-knappe/node-red-google-calendar 3.1.0
Enhanced Google Calendar nodes for Node-RED with improved error handling, event links, and authentication. Based on @platmac/node-red-google-calendar with significant improvements.
Node-RED Google Calendar Enhanced
Enhanced Google Calendar nodes for Node-RED with improved error handling, event links, delete functionality, and robust OAuth2 authentication.
Note: This package is based on the original work by @platmac/node-red-google-calendar with significant improvements and enhancements.
✨ Features
- 📅 Complete Calendar Operations: Create, read, update, and delete Google Calendar events
- 🔗 Event Links: Direct links to calendar events and Google Meet video calls
- 🛡️ Robust Error Handling: Comprehensive error responses with detailed debugging information
- 🔐 Enhanced Authentication: Improved OAuth2 token refresh and management
- 📧 Attendee Management: Support for event attendees and notifications
- 🎥 Google Meet Integration: Automatic conference creation with video links
- 🌍 Timezone Support: Proper timezone handling for global events
🚀 What's New in v3.0.1
- NEW:
deleteEvent
node for removing calendar events - IMPROVED: Enhanced error handling across all modules
- FIXED: OAuth2 token refresh issues causing 401 errors
- ADDED: Event links (EventLink and MeetLink) in all responses
- ENHANCED: Proactive token management with expiry buffering
📦 Installation
Via Node-RED Palette Manager (Recommended)
- Open Node-RED
- Go to Manage Palette → Install
- Search for
@marek-knappe/node-red-google-calendar
- Click Install
Via npm
npm install @marek-knappe/node-red-google-calendar
🔧 Setup & Configuration
1. Google Calendar API Setup
Create Google Cloud Project
- Go to Google Cloud Console
- Create a new project or select existing one
Enable Google Calendar API
- Go to APIs & Services → Library
- Search for "Google Calendar API"
- Click Enable
Create OAuth 2.0 Credentials
- Go to APIs & Services → Credentials
- Click Create Credentials → OAuth 2.0 Client IDs
- Choose Web application
- Add authorized redirect URIs (shown in Node-RED)
2. Node-RED Configuration
Add Calendar Node
- Drag any Google Calendar node to your flow
- Click Edit on the Google Account field
Enter Credentials
- Client ID: From Google Cloud Console
- Client Secret: From Google Cloud Console
Authenticate
- Click Authenticate with Google
- Grant permissions in browser
- Click Add to complete setup
📋 Available Nodes
🔍 Get Event
Retrieves events from Google Calendar within a specified time range.
Input Properties:
msg.payload.timemin
- Start time (e.g., "2024-01-01 09:00:00")msg.payload.timemax
- End time (e.g., "2024-01-01 17:00:00")msg.calendarId
- Calendar ID (e.g., "[email protected]")
Output Properties:
msg.payload
- Array of event objectsmsg.eventId
- Event identifiermsg.calendarId
- Calendar IDmsg.start
- Event start timemsg.end
- Event end timemsg.title
- Event titlemsg.attendees
- List of attendeesmsg.EventLink
- Direct link to calendar eventmsg.MeetLink
- Google Meet video call link
➕ Add Event
Creates new events in Google Calendar.
Input Properties:
msg.calendarId
- Target calendar IDmsg.title
- Event titlemsg.description
- Event descriptionmsg.location
- Event locationmsg.start
- Start timemsg.end
- End timemsg.timezone
- Timezone offsetmsg.conference
- Enable Google Meet
Output Properties:
msg.payload
- Success/Error messagemsg.eventId
- Created event IDmsg.meetLink
- Google Meet link (if enabled)msg.eventLink
- Direct calendar event linkmsg.success
- Boolean success flag
✏️ Update Event
Modifies existing calendar events.
Input Properties:
msg.calendarId
- Calendar IDmsg.eventId
- Event ID to updatemsg.title
- New titlemsg.description
- New descriptionmsg.location
- New locationmsg.conference
- Enable/disable Google Meetmsg.emailNotify
- Notify attendees of changes
Output Properties:
msg.payload
- Success/Error messagemsg.thisEventId
- Updated event IDmsg.meetLink
- Google Meet linkmsg.eventLink
- Direct calendar event linkmsg.success
- Boolean success flag
🗑️ Delete Event
Removes events from Google Calendar.
Input Properties:
msg.calendarId
- Calendar IDmsg.eventId
- Event ID to deletemsg.emailNotify
- Notify attendees of deletion
Output Properties:
msg.payload
- Success/Error messagemsg.eventId
- Deleted event IDmsg.calendarId
- Calendar IDmsg.success
- Boolean success flag
💡 Use Cases
🤖 Automated Meeting Reminders
// Get upcoming meetings and send reminders
const events = await getEvents({ timemin: "now", timemax: "+1h" });
events.forEach(event => {
if (event.attendees.length > 0) {
sendReminder(event.title, event.EventLink, event.attendees);
}
});
🏢 Room Booking System
// Check room availability and book
const availability = await getEvents({
calendarId: "[email protected]",
timemin: "2024-01-15 09:00:00",
timemax: "2024-01-15 10:00:00"
});
if (availability.length === 0) {
await addEvent({
calendarId: "[email protected]",
title: "Team Meeting",
start: "2024-01-15 09:00:00",
end: "2024-01-15 10:00:00"
});
}
📅 Daily Agenda Notifications
// Send daily agenda to team
const today = new Date().toISOString().split('T')[0];
const agenda = await getEvents({
timemin: today + " 00:00:00",
timemax: today + " 23:59:59"
});
const agendaText = agenda.map(event =>
`${event.start} - ${event.title}`
).join('\n');
sendNotification("Today's Agenda", agendaText);
🏠 Smart Home Integration
// Trigger home automation based on calendar events
const events = await getEvents({ timemin: "now", timemax: "+30m" });
events.forEach(event => {
if (event.title.includes("Meeting")) {
turnOnLights();
adjustThermostat();
sendNotification("Meeting starting soon", event.EventLink);
}
});
🔍 Error Handling
All nodes provide comprehensive error handling with consistent response formats:
// Success response
{
payload: "Successfully added event to calendar",
success: true,
eventId: "abc123",
eventLink: "https://calendar.google.com/event/...",
meetLink: "https://meet.google.com/..."
}
// Error response
{
payload: "Failed to add event: HTTP Error: 400 - Invalid request",
success: false,
error: "HTTP Error: 400 - Invalid request",
statusCode: 400
}
🛠️ Troubleshooting
Common Issues
401 Authentication Error
- Tokens automatically refresh every 5 minutes
- Check Google Cloud Console credentials
- Ensure Calendar API is enabled
Calendar Not Found
- Verify calendar ID format
- Check calendar sharing permissions
- Ensure OAuth scope includes calendar access
Event Creation Fails
- Validate date/time formats
- Check required fields (title, start, end)
- Verify calendar write permissions
Debug Mode
Enable detailed logging in Node-RED settings to troubleshoot issues.
📚 Examples
See the examples/
folder for complete flow examples and screenshots.
🤝 Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
📄 License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
🙏 Acknowledgments
- Original Work: Based on @platmac/node-red-google-calendar by Hooke Jr.
- Enhancements: Significant improvements by Marek Knappe
- Community: Node-RED community for feedback and testing
📞 Support
- Issues: GitHub Issues
- Documentation: GitHub Wiki
- Email: [email protected]
Made with ❤️ for the Node-RED community