Skip to content

Edsol/php-clickup-api-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unofficial ClickUp API Client
see ClickUp Api Docs

License: AGPL v3

Requirements

You need to have a ClickUp token, use official guide to create one

Install

composer require edsol/php-clickup-api-client

Implementations

Team

  • Read
  • get Spaces

Space

  • Read
  • get Tags

Folder

  • Create
  • Read
  • Create List

Task

  • Create
  • Read
  • Update
  • Delete
  • Add attachment/s
  • Add assignee/s
  • Get members

Comment

  • Read
  • Create
  • Update
  • Delete

Webhook

  • List
  • Create
  • Update
  • Delete

Usage

First, initialize the client:

$clickup = new \ClickUpClient\Client('CLICK_UP_API_TOKEN');

Team

$clickup->team()->all();
$clickup->team()->spaces();
$clickup->team()->user('USER_ID');

Space

$clickup->space()->get("SPACE_ID");
$clickup->space('SPACE_ID')->tags();
$clickup->space('SPACE_ID')->folders();
$clickup->space('SPACE_ID')->folderlessLists();

Folder

$clickup->folder("SPACE_ID")->lists();
$clickup->folder("FOLDER_ID")->get();
$clickup->folder()->get("FOLDER_ID");
$clickup->folder("SPACE_ID")->create("FOLDER_NAME");
$clickup->folder("SPACE_ID")->createList("LIST_NAME");

List

$clickup->taskList("LIST_ID")->get();
$clickup->taskList("LIST_ID")->getTasks();
$clickup->taskList("LIST_ID")->comments();
$clickup->taskList("LIST_ID")->members();
$clickup->taskList("LIST_ID")->getCustomFields();

Task

$clickup->task("TASK_ID")->get();
$clickup->task("TASK_ID")->comments();
$clickup->task("TASK_ID")->members();

$clickup->task("TASK_ID")->add([
    "name": "Updated Task Name",
    "description": "Updated Task Content",
]);
$clickup->task("TASK_ID")->delete();
$clickup->task("TASK_ID")->update([
    "name": "Updated Task Name",
    "description": "Updated Task Content"
]);

$clickup->task("TASK_ID")->addAssignees([
    MEMBER_ID_1,
    MEMBER_ID_2,
]);
$clickup->task("TASK_ID")->addAssignee(MEMBER_ID);

$attachment = new \ClickUpClient\Objects\Attachment([
    'contents' => \GuzzleHttp\Psr7\Utils::tryFopen('FILE_PATH', 'r'),
    'filename' => 'filename.txt'
]);
$clickup->task("TASK_ID")->addAttachment($attachment);

$attachments = new \ClickUpClient\Objects\AttachmentCollection([
    [
        'contents' => \GuzzleHttp\Psr7\Utils::tryFopen('FILE_PATH', 'r'),
        'filename' => 'filename1.txt'
    ],
    [
        'contents' => \GuzzleHttp\Psr7\Utils::tryFopen('FILE_PATH', 'r'),
        'filename' => 'filename2.txt'
    ],
]);
$clickup->task("TASK_ID")->addAttachments($attachments);
$clickup->task("TASK_ID")->setCustomField("FIELD_ID","NEW_FIELD_VALUE");
$clickup->task("TASK_ID")->deleteCustomField("FIELD_ID");

Comment

$clickup->comment('COMMENT_ID')->update([
    'comment_text' => "update comment text"
]);
$clickup->comment()->deleteComment('COMMENT_ID');

Webhook

$clickup->team('TEAM_ID')->webhooks();
$clickup->team('TEAM_ID')->createWebhook([
    'endopint' => 'ENDPOINT_URL',
    'events' => [
        "taskCreated",
        "taskUpdated",
        "taskDeleted",
    ],
]);
$clickup->webhook('WEBHOOK_ID')->updateWebhook([
    'endopint' => 'ENDPOINT_URL',
    'events' => [
        "taskCreated",
        "taskUpdated",
        "taskDeleted",
    ],
]);
$clickup->webhook('WEBHOOK_ID')->delete();

Webhook payloads classes

This package also provides classes to strongly type the payloads received from webhooks.

For example:

// If your request body is an array, you need to convert it to an object
$request_body_object = json_decode(json_encode($request_body_array), false);

$task_comment_posted_payload = new \ClickUpClient\Objects\Webhook\Task\TaskCommentPostedPayload($request_body_object);

This allows you to work with a fully typed webhook payload, making it easier to handle and access its data within your application.

Space
  • spaceCreated
  • spaceUpdated
  • spaceDeleted
Folder
  • folderCreated
  • folderUpdated
  • folderDeleted
List
  • listCreated
  • listUpdated
  • listDeleted
Task
  • taskCreated
  • taskUpdated
  • taskDeleted
  • taskPriorityUpdated
  • taskStatusUpdated
  • taskAssigneeUpdated
  • taskDueDateUpdated
  • taskTagUpdated
  • taskMoved
  • taskCommentPosted
  • taskCommentUpdated
  • taskTimeEstimateUpdated
  • taskTimeTrackedUpdated

About

Unofficial PHP ClickUp API client (v2)

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages