/lovable-integrations

Lovable and Clockify integration: Step-by-Step Guide 2025

Learn how to integrate Lovable with Clockify for seamless time tracking and CRM management. Follow our step-by-step guide to enhance your workflow!

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to integrate Lovable with Clockify?

 

Creating the Clockify Service File

 
  • Create a new file in your Lovable project named clockify.ts in the same folder where your other TypeScript files are located.
  • Copy and paste the following code into clockify.ts. This code defines a service to interact with the Clockify REST API using HTTP requests.
    
    import axios from 'axios';
    
    

    interface TimeEntry {
    id?: string;
    description: string;
    start: string;
    end?: string;
    projectId?: string;
    }

    export class ClockifyService {
    private apiKey: string;
    private workspaceId: string;
    private baseUrl: string;

    constructor(apiKey: string, workspaceId: string) {
    this.apiKey = apiKey;
    this.workspaceId = workspaceId;
    this.baseUrl = 'https://api.clockify.me/api/v1';
    }

    async getCurrentUser(): Promise {
    try {
    const response = await axios.get(${this.baseUrl}/user, {
    headers: {
    'X-Api-Key': this.apiKey,
    },
    });
    return response.data;
    } catch (error) {
    console.error('Error fetching current user:', error);
    throw error;
    }
    }

    async getTimeEntries(userId: string): Promise<TimeEntry[]> {
    try {
    const response = await axios.get(${this.baseUrl}/workspaces/${this.workspaceId}/user/${userId}/time-entries, {
    headers: {
    'X-Api-Key': this.apiKey,
    },
    });
    return response.data;
    } catch (error) {
    console.error('Error fetching time entries:', error);
    throw error;
    }
    }

    async createTimeEntry(userId: string, entry: TimeEntry): Promise {
    try {
    const response = await axios.post(${this.baseUrl}/workspaces/${this.workspaceId}/user/${userId}/time-entries, entry, {
    headers: {
    'X-Api-Key': this.apiKey,
    'Content-Type': 'application/json',
    },
    });
    return response.data;
    } catch (error) {
    console.error('Error creating time entry:', error);
    throw error;
    }
    }
    }


 

Creating the Integration File

 
  • Create a new file named clockifyIntegration.ts in your project. This file will use the ClockifyService to make API calls.
  • Paste the following code inside clockifyIntegration.ts. Replace YOURCLOCKIFYAPIKEY and YOURWORKSPACE_ID with your actual Clockify API key and workspace ID.
    
    import { ClockifyService } from './clockify';
    
    

    const APIKEY = 'YOURCLOCKIFYAPIKEY';
    const WORKSPACEID = 'YOURWORKSPACE_ID';

    const clockifyService = new ClockifyService(APIKEY, WORKSPACEID);

    async function testClockifyIntegration() {
    try {
    const user = await clockifyService.getCurrentUser();
    console.log('Clockify User:', user);

    const timeEntries = await clockifyService.getTimeEntries(user.id);
    console.log('Time Entries:', timeEntries);
    
    // Example: Creating a new time entry
    const newEntry = {
      description: 'Test time entry',
      start: new Date().toISOString(),
    };
    
    const createdEntry = await clockifyService.createTimeEntry(user.id, newEntry);
    console.log('Created Entry:', createdEntry);
    

    } catch (error) {
    console.error('Integration test error:', error);
    }
    }

    testClockifyIntegration();


 

Adding the Axios Dependency Without a Terminal

 
  • Since Lovable does not have a terminal for installing dependencies, you need to manually include the axios dependency.
  • If your project uses a package.json file, open it and add the following entry under the "dependencies" section:
    
    {
      "dependencies": {
        "axios": "^0.21.1"
        // ... other dependencies
      }
    }
    
  • If your project setup supports adding dependencies via a configuration file or a designated dependency management section, ensure that axios (version 0.21.1 or above) is included.

 

Integrating the Clockify Feature in Your Lovable Project

 
  • Decide where in your Lovable project you want the Clockify integration to be triggered. For example, you might call the integration functions when a user logs in or when a time tracking action is required.
  • Import clockifyIntegration.ts into your main application file or the appropriate module. For instance, add the following import statement to your main TypeScript file:
    
    // In your main application file
    import './clockifyIntegration';
    
  • By importing the file, the test function testClockifyIntegration() will run and log the results in the browser console.

 

Final Testing and Debugging

 
  • Open your project in Lovable’s interface. If there is a preview or console area, check it for output logs.
  • Verify that the current user is fetched correctly, time entries are logged, and a new time entry is created.
  • If any errors occur, review the console messages to help debug the issue and ensure that your API key and workspace ID are correct.

 

Still stuck?
Copy this prompt into ChatGPT and get a clear, personalized explanation.

This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.

AI AI Prompt

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022