@cardtunic/clickup v1.1.0-e
ClickUp API SDK
A simple TypeScript SDK for interacting with the ClickUp API.
Installation
npm install @cardtunic/clickupUsage
import clickup from "@cardtunic/clickup";
const clickupClient = clickup.createClient(process.env.CLICKUP_TOKEN);
const createdTask = await clickupClient.tasks.create("list-id", {
name: "My Task",
description: "This is my task",
due_date: "2023-01-01",
custom_fields: [
{
id: "custom-field-id",
value: "custom-field-value",
},
],
});
console.log(`Task created with id: ${createdTask.id}`);Authentication
To use the ClickUp API, you need to authenticate with your OAuth2 token. You can get it by running the following command:
npm clickup-cli loginThis command will generate a URL, that you can login and get a code, paste it, and your access token will be saved in your .env file.
Generating config files
To make your life easier, you can use the clickup-cli config to generate a config.clickup.ts at the root of your project, with the workspace, spaces, folders, lists and custom fields, to quick access them, like this:
import clickupConfig from "./config.clickup.ts";
const createdTask = await clickupClient.tasks.create(
clickupConfig.workspace.spaces.fun_space.lists.my_list.id,
{
name: "My Task",
description: "This is my task",
due_date: "2023-01-01",
custom_fields: [
{
id: clickupConfig.workspace.custom_fields.cool_custom_field.id,
value: "custom-field-value",
},
],
}
);Just run the command bellow:
npm clickup-cli config1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago