Skip to content

pixtron/toggl-webhook

Repository files navigation

toggl-webhook

This module provides a wrapper for the toggl track webhook api.

Install

npm install --save toggl-webhook

Warning: This package is native ESM and does not provide a CommonJS export. If your project uses CommonJS, you'll have to convert to ESM or use the dynamic import() function. Please don't open issues for questions regarding CommonJS / ESM.

Usage

import { TogglWebhookClient } from 'toggl-webhook';

const client = new TogglWebhookClient({
  apiToken: 'XXX',
  userAgent: 'bob@example.com'
});

const subscription = await client.createSubscription({
  workspace_id: 10000,
  url_callback: 'https://example.com/hook',
  event_filters: [{entity: 'project', action: 'create'}],
  description: 'unique subscription description',
  secret: 'shhhh',
  enabled: true
});

API docs

See the API docs.

Recieve and validate webhook events with express

toggl-webhook-express provides a middleware to validate incoming toggl webhook requests.