0

List Discussions with a Row

by
Published Oct 17, 2025

Gets a list of all discussions associated with the specified row. Remember that discussions are containers for the conversation thread. To see the entire thread, use the include=comments parameter.

Script smartsheet Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Smartsheet = {
3
  token: string;
4
  baseUrl: string;
5
};
6
/**
7
 * List Discussions with a Row
8
 * Gets a list of all discussions associated with the specified row. Remember that discussions are containers
9
for the conversation thread. To see the entire thread, use the include=comments parameter.
10

11
 */
12
export async function main(
13
  auth: Smartsheet,
14
  sheetId: string,
15
  rowId: string,
16
  include: "attachments" | "comments" | undefined,
17
  page: string | undefined,
18
  pageSize: string | undefined,
19
  includeAll: string | undefined,
20
) {
21
  const url = new URL(
22
    `${auth.baseUrl}/sheets/${sheetId}/rows/${rowId}/discussions`,
23
  );
24
  for (const [k, v] of [
25
    ["include", include],
26
    ["page", page],
27
    ["pageSize", pageSize],
28
    ["includeAll", includeAll],
29
  ]) {
30
    if (v !== undefined && v !== "" && k !== undefined) {
31
      url.searchParams.append(k, v);
32
    }
33
  }
34
  const response = await fetch(url, {
35
    method: "GET",
36
    headers: {
37
      Authorization: "Bearer " + auth.token,
38
    },
39
    body: undefined,
40
  });
41
  if (!response.ok) {
42
    const text = await response.text();
43
    throw new Error(`${response.status} ${text}`);
44
  }
45
  return await response.json();
46
}
47