This Google Apps Script (GAS) project automates the creation of calendar invites (.ics
files) based on email content. When a new email arrives at a designated inbox, the script processes the email to extract event details using the OpenAI API, generates an .ics
file, and sends a reply with the event invite attached.
- Automated Email Processing: Automatically scans for unread emails in the designated inbox.
- AI-Powered Event Extraction: Uses OpenAI API to extract event details (title, start time, end time, location) from email content.
- Calendar Invite Generation: Creates
.ics
files compatible with most calendar applications. - Automated Reply: Sends a reply email with the generated
.ics
file attached.
- Monitors a specified email address for unread messages.
- Extracts event details from the most recent email in each thread using the OpenAI API.
- Generates an
.ics
file with the extracted event details. - Replies to the original email with the
.ics
file attached.
- A Google Workspace account.
- Access to the Gmail and Google Apps Script APIs.
- An OpenAI API key for accessing the GPT model.
-
Clone the Repository: Clone this repository or copy the script file into the Google Apps Script editor.
-
Configure the Script:
- Replace the
TARGET_EMAIL
constant with the email address you want to monitor. - Set up your OpenAI API key in the script's properties:
- Navigate to
File > Project Properties > Script Properties
in the Apps Script editor. - Add a property with the name
OPENAI_API_KEY
and your OpenAI API key as the value.
- Navigate to
- Replace the
-
Authorize Permissions:
- Run the
createTrigger
function to set up the time-driven trigger (runs every minute). - Grant the necessary permissions when prompted.
- Run the
-
Deploy the Script:
- Deploy the script as a standalone Apps Script project.
- Send an email to the configured
TARGET_EMAIL
address. - The script will process the email, extract event details, generate an
.ics
file, and send a reply. - Open the
.ics
file to add the event to your calendar.
Contributions, suggestions, and bug reports are welcome! Please open an issue or submit a pull request to improve this project, or email me on edfagedeveloper@gmail.com
This project is licensed under the MIT License. See the LICENSE
file for details.
Developer Contact: For questions or feature suggestions, reach out to edfagedeveloper@gmail.com.