0

Get Chat View Comments

by
Published Oct 17, 2025

View comments from a Chat view. \ \ 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 Chat View Comments
7
 * View comments from a Chat view. \
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
  view_id: string,
16
  start: string | undefined,
17
  start_id: string | undefined,
18
) {
19
  const url = new URL(`https://api.clickup.com/api/v2/view/${view_id}/comment`);
20
  for (const [k, v] of [
21
    ["start", start],
22
    ["start_id", start_id],
23
  ]) {
24
    if (v !== undefined && v !== "" && k !== undefined) {
25
      url.searchParams.append(k, v);
26
    }
27
  }
28
  const response = await fetch(url, {
29
    method: "GET",
30
    headers: {
31
      Authorization: auth.token,
32
    },
33
    body: undefined,
34
  });
35
  if (!response.ok) {
36
    const text = await response.text();
37
    throw new Error(`${response.status} ${text}`);
38
  }
39
  return await response.json();
40
}
41