0

Get Task Comments

by
Published Oct 17, 2025

View task comments. \ \ If you do not include the `start` and `start_id` parameters, this endpoint will return the most recent 25 comments.\ \ Use the `start` and `start id` parameters of the oldest comment to retrieve the next 25 comments.

Script clickup Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Clickup = {
3
  token: string;
4
};
5
/**
6
 * Get Task Comments
7
 * View task comments. \
8
 \
9
If you do not include the `start` and `start_id` parameters, this endpoint will return the most recent 25 comments.\
10
 \
11
Use the `start` and `start id` parameters of the oldest comment to retrieve the next 25 comments.
12
 */
13
export async function main(
14
  auth: Clickup,
15
  task_id: string,
16
  custom_task_ids: string | undefined,
17
  team_id: string | undefined,
18
  start: string | undefined,
19
  start_id: string | undefined,
20
) {
21
  const url = new URL(`https://api.clickup.com/api/v2/task/${task_id}/comment`);
22
  for (const [k, v] of [
23
    ["custom_task_ids", custom_task_ids],
24
    ["team_id", team_id],
25
    ["start", start],
26
    ["start_id", start_id],
27
  ]) {
28
    if (v !== undefined && v !== "" && k !== undefined) {
29
      url.searchParams.append(k, v);
30
    }
31
  }
32
  const response = await fetch(url, {
33
    method: "GET",
34
    headers: {
35
      Authorization: auth.token,
36
    },
37
    body: undefined,
38
  });
39
  if (!response.ok) {
40
    const text = await response.text();
41
    throw new Error(`${response.status} ${text}`);
42
  }
43
  return await response.json();
44
}
45