This script syncs Google Calendar events with Habitica tasks and vice versa. It automates the process so that your calendar events appear in Habitica as to-dos, and your Habitica tasks show up in your Google Calendar.
- Google Calendar ➝ Habitica: Converts upcoming calendar events into Habitica tasks.
- Habitica ➝ Google Calendar: Adds Habitica to-dos to Google Calendar.
- Automatic Syncing: Runs every few minutes using Google Apps Script triggers.
- A Google Calendar.
- A Habitica account.
- Your Habitica API User ID and API Token.
- Your Google Calendar ID.
- A Habitica Tag ID (optional, used to filter specific tasks).
- Log into Habitica.
- Go to User > Settings.
- Scroll to API Settings.
- Copy your User ID and API Token.
- Open Google Calendar.
- Find the calendar you want to sync.
- Click Settings (⚙) > Settings.
- Under Integrate Calendar, copy the Calendar ID (e.g.,
your-email@gmail.com
orxyz@group.calendar.google.com
).
- Open Habitica.
- Go to Tasks > Tags.
- Create a new tag or select an existing one.
- Right-click the tag and copy its ID from the URL (it looks like
abcdef12-3456-7890-abcd-1234567890ef
).
- Go to Google Apps Script.
- Create a new project.
- Copy and paste the script from this repository.
- Replace the placeholders with your Google Calendar ID, Habitica User ID, API Token, and Tag ID.
Run the setup()
function once to save your API credentials securely.
Run createSafeTrigger()
to set up a time-based trigger that syncs Habitica and Google Calendar every few minutes.
- Run
syncHabiticaCalendar()
manually or wait for the automatic trigger. - View your Habitica tasks in Google Calendar and your calendar events in Habitica.
- API Rate Limits: Habitica allows a limited number of API requests per hour.
- Duplicate Prevention: The script avoids duplicate tasks and events.
- Customization: Modify sync intervals, filtering, and formatting in the script.
- Nothing syncs? Ensure API keys, Calendar ID, and Tag ID are correct.
- Too many events? Adjust the sync time range in the script.
- Not updating automatically? Check if the trigger is active under Google Apps Script > Triggers.
Feel free to submit issues or pull requests to improve the script!