Skip to content

Instantly share code, notes, and snippets.

@chip
Created December 12, 2016 22:39
Show Gist options
  • Save chip/929be696d8742a6fa3d91d09b98fb532 to your computer and use it in GitHub Desktop.
Save chip/929be696d8742a6fa3d91d09b98fb532 to your computer and use it in GitHub Desktop.
Toggl Bot sample for Slack
// TOGGL is a web-based time-tracking service: http://toggl.com
import { togglApi, togglParser } from '../dist/togglApi'
const apiToken = process.env.TOGGL_API_TOKEN
// Request account profile from the Toggl API
togglApi({apiToken}).fetchData('/me')
.then(function(data) {
// Return your default workspace id so that we can then make calls for clients, projects, time entries, etc.
console.log(togglParser({ data }).workspaceId())
})
// TODO: API endpoints for Slack bot
//
// 1. Prompt user to enter their Toggl API key. /setup
// 2. Retrieve client listing. /clients
// 3. Generate invoice for client. /invoice
//
// Need to accept other input from user such as date range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment