Seeking some help and guidance on my goal/objective.
I would like to be able to create a new event/task in google calendar and it automatically update into clockify with the correct colors/categories/projects.
Right now, when I create a new event in google calendar, it does create an event in Clockify, BUT, it does not automatically apply the right categories/projects/colors, so I can track the time.
Is my objective of creating a new task and event in google calendar and automatically create the same event in clockify with the categories/projects/colors i want track time by?
Also what about vice versa, can I create the event in clockify with the categories/projects/colors and have it automatically sync to google calendar with the right categorie/projects/colors?
Unfortunately, our Google Calendar integration is only one-way, not two-way integration, meaning that the information can only be transferred from the Google calendar to the Clockify calendar but not the other way due to the Google calendar permissions.
For now, it would not be possible to automate the copying of the events as time entries and assigning them to responding projects.
If you wish, you can always suggest this as a feature by filling out our Feature suggestion form.
This would be a great feature to implement. Having a two-way sync with Google Calendar is really helpful for us. We use Clockify to schedule work for our employees but then we would have to manually add events in Google Calendar for everyone to book their calendars.
I agree that would be a great option, so I wanted to add that Clockify recently launched a marketplace where users can develop their own add-ons for our products, and that will allow users to create integrations that could be useful!
Hello everyone,
for anyone interested you can make a very simple two way sync with google appscripts. just replace the api key from clockify and give the script permissions to your calendar.
function getClockifyUserInfo() {
const apiKey = 'ClockifyAPIKEY'; // Replace with your Clockify API key
const userUrl = 'https://api.clockify.me/api/v1/user';
const headers = {
'X-Api-Key': apiKey
};
// Step 1: Get current user info
const userResponse = UrlFetchApp.fetch(userUrl, { method: 'get', headers });
const userData = JSON.parse(userResponse.getContentText());
const userId = userData.id;
const workspaceId = userData.activeWorkspace;
// Step 2: Create start and end of today in ISO format
const now = new Date();
const startOfDay = new Date(now);
startOfDay.setDate(startOfDay.getDate() - 1);
startOfDay.setHours(0, 0, 0, 0);
const endOfDay = new Date(now);
endOfDay.setHours(23, 59, 59, 999);
const startIso = startOfDay.toISOString();
const endIso = endOfDay.toISOString();
// Step 3: Build URL with query parameters
const entriesUrl = `https://api.clockify.me/api/v1/workspaces/${workspaceId}/user/${userId}/time-entries?start=${encodeURIComponent(startIso)}&end=${encodeURIComponent(endIso)}&hydrated=true&page-size=500`;
// Step 4: Fetch time entries for today
const entriesResponse = UrlFetchApp.fetch(entriesUrl, { method: 'get', headers });
const entries = JSON.parse(entriesResponse.getContentText());
// Step 5: Log results
Logger.log(`Time entries for ${now.toDateString()}:`);
Logger.log(JSON.stringify(entries, null, 2));
// Step 6: Add each entry to Google Calendar
const calendar = CalendarApp.getDefaultCalendar(); // Or use CalendarApp.getCalendarById('your-calendar-id')
entries.forEach(entry => {
// Skip running entries without end time
if (!entry.timeInterval.end) {
Logger.log(`⏭️ Skipping running entry: ${entry.description || 'No description'} (start: ${entry.timeInterval.start})`);
return;
}
const start = new Date(entry.timeInterval.start);
const end = new Date(entry.timeInterval.end);
const title = entry.description || 'Clockify Entry';
// Definiere die Standardfarbe (yellow)
let colorId = 5; // yellow
// Prüfe, ob das Tag 'Eat' oder 'Sleep' ist und setze entsprechende Farben
if (entry.tags.some(tag => tag.name === 'Eat')) {
colorId = 7; // Blau
} else if (entry.tags.some(tag => tag.name === 'Sleep')) {
colorId = 8; // Grau
}else if (entry.tags.some(tag => tag.name === 'Friends/Family')) {
colorId = 2; // Green
}else if (entry.tags.some(tag => tag.name === 'Sports')) {
colorId = 6; // Orange
}else if (entry.tags.some(tag => tag.name === 'SFZ')) {
colorId = 2; // Green
}else if (entry.tags.some(tag => tag.name === 'BII')) {
colorId = 4; // Red
}else if (entry.tags.some(tag => tag.name === 'Chill')) {
colorId = 1; // Red
}
// ±1 Minute Toleranzzeit zum Finden bestehender Events
const rangeStart = new Date(start.getTime() - 60000);
const rangeEnd = new Date(end.getTime() + 60000);
const existingEvents = calendar.getEvents(rangeStart, rangeEnd);
// Filter nach exaktem Titel & exakt übereinstimmender Zeit
const duplicate = existingEvents.some(event => {
return event.getTitle() === title &&
Math.abs(event.getStartTime() - start) < 60000 && // max ±1 Minute
Math.abs(event.getEndTime() - end) < 60000;
});
if (!duplicate) {
const event = calendar.createEvent(title, start, end, {
description: `Imported from Clockify\nTag: ${(entry.tags[0]?.name || 'No Tag')}\nProject: ${(entry.project?.name || 'No Project')}`
});
event.setColor(colorId);
Logger.log(`✅ Created event: ${title} (${start.toISOString()} - ${end.toISOString()})`);
} else {
Logger.log(`⏭️ Skipped duplicate: ${title} (${start.toISOString()} - ${end.toISOString()})`);
}
});
}