Event Scheduler Bot is a Python-based tool that automates Google Calendar tasks. With this bot, you can create, list, and delete events directly from your terminal. It uses the Google Calendar API to interact with your calendar.
-
Create New Events:
- Add event details such as title, location, description, date, and time.
- Automatically generate an Event ID and shareable event link.
-
List Upcoming Events:
- View a list of the next 10 events from your Google Calendar.
- Display event start time and title.
-
Delete Events:
- Delete events using their Event ID.
-
User Input Validation:
- Ensures all inputs (date, time, etc.) follow the correct format.
- Python 2.7: This tool is compatible with Python 2.7.
- Google API Client Library:
- Install it using
pip install --upgrade google-api-python-client oauth2client
.
- Install it using
- Google Calendar API:
- Enable the Google Calendar API for your Google Cloud project.
- Credential Files:
- Download the
credentials.json
file from the Google Cloud Console and place it in the same directory as the script.
- Download the
The credentials.json
file is required to authenticate your application with the Google Calendar API. Follow these steps to get it:
- Open the Google Cloud Console.
- Log in with your Google account.
- If you don’t have a project:
- Click "Create Project".
- Enter a project name (e.g., "Event Scheduler Bot").
- Click "Create".
- If you already have a project:
- Select the project you want to use.
- In the navigation menu, go to "API & Services" > "Library".
- Search for "Google Calendar API" in the search box.
- Click on "Google Calendar API", then click the "Enable" button.
- Go to "API & Services" > "Credentials".
- Click the "Create Credentials" button and select "OAuth client ID".
- If prompted to configure the OAuth consent screen:
- Click "Configure consent screen".
- Choose "External".
- Fill in details like the app name (e.g., "Event Scheduler Bot").
- Click "Save and Continue" until the process is complete.
- Select "Desktop app" as the application type.
- Click "Create".
- Download the
credentials.json
file and save it in the same directory as your Python script.
- Place the
credentials.json
file in the directory where you are running the Python script. - Ensure the file is named credentials.json for the script to recognize it.
- Execute the Python script:
python event_scheduler_bot.py
- On the first run, you’ll be prompted to log in to your Google account.
- The script will automatically save the authentication token in a file called
token.json
.
- Do not share your
credentials.json
ortoken.json
files with anyone, as they contain sensitive information that grants access to your Google Calendar. - If you encounter issues, ensure:
- The Google Calendar API is enabled for your project.
- You’re using the same Google account when logging in during the script’s execution.
- Clone the repository or download the script file.
- Ensure
credentials.json
is in the same directory. - Install dependencies:
pip install --upgrade google-api-python-client oauth2client
- Run the script:
python event_scheduler_bot.py
-
1. Create a New Event:
- Enter event details as prompted.
- Example input:
Event Title: Meeting Location: Office Description: Team meeting Date: 2025-01-01 Start Time: 10:00 End Time: 11:00
- Output:
Event created successfully! Event ID: abc123xyz456 Event Link: https://www.google.com/calendar/event?eid=abc123xyz456
-
2. List Upcoming Events:
- Lists the next 10 events, displaying the date and title.
-
3. Delete an Event:
- Enter the Event ID from the list or creation output to delete an event.
-
4. Exit:
- Exit the program.
--- Create a New Event ---
Event Title: Team Meeting
Location: Office
Description: Monthly team discussion
Date: 2025-01-10
Start Time: 10:00
End Time: 11:30
Event created successfully!
Event ID: abc123xyz456
Event Link: https://www.google.com/calendar/event?eid=abc123xyz456
--- Upcoming Events ---
2024-12-25T22:30:00+07:00 - Christmas Party
2025-01-10T10:00:00+07:00 - Team Meeting
--- Delete an Event ---
Enter Event ID to delete: abc123xyz456
Event deleted successfully.
- Requires an active internet connection to interact with Google Calendar API.
- Only supports basic event creation, listing, and deletion.