diff --git a/README.md b/README.md index 1ad49e6..4eb3347 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,14 @@ ## Usage -1. Build this script, which will generate `dist/bundle.js`. +1. Insert your `CALENDAR_ID` and `TOGGL_API_TOKEN` properties in the `src/index.ts` file. +1. Build the script, which will generate `dist/bundle.js`. ``` npm install npm run build ``` 1. Upload `dist/index.js` and `dist/bundle.js` to Google Apps Script. If you're using [@google/clasp](https://github.com/google/clasp), edit `scriptId` property in `.clasp.json` and run `npm run deploy`. -1. Set `CALENDAR_ID` and `TOGGL_API_TOKEN` script properties. 1. Create a Time-driven trigger to run `main` function periodically (e.g. every hour). ### Custom variables (script properties) diff --git a/src/index.ts b/src/index.ts index 3ce0afc..d6270a3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,6 +3,10 @@ import { EntriesHash, sync } from './calendar'; export function run() { const scriptProperties = PropertiesService.getScriptProperties(); + + scriptProperties.setProperty('CALENDAR_ID', 'INSERT CALENDAR ID HERE'); + scriptProperties.setProperty('TOGGL_API_TOKEN', 'INSERT TOGGL API TOKEN HERE'); + const togglApiToken = scriptProperties.getProperty('TOGGL_API_TOKEN'); const calendarId = scriptProperties.getProperty('CALENDAR_ID'); diff --git a/src/toggl.ts b/src/toggl.ts index 611d136..2f41050 100644 --- a/src/toggl.ts +++ b/src/toggl.ts @@ -1,4 +1,4 @@ -const baseUrl = 'https://www.toggl.com/api/v8/'; +const baseUrl = 'https://api.track.toggl.com/api/v8/'; export interface Project { id: number;