Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working version! #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion src/toggl.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down