0

Get all forwards by conversation

by
Published Oct 17, 2025

Retrieves all forwarded conversations based on the unique conversation ID. To learn more, see [Forwarding conversations](https://help.kustomer.com/forwarding-SJN_iaACN) in the Kustomer Help Center. Any one of the following roles is required for this endpoint: |Legacy Role|Equivalent Permission Set Role| |-----|--------| |org.user.draft.read|org.permission.draft.read|

Script kustomer Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Kustomer = {
3
  apiKey: string;
4
};
5
/**
6
 * Get all forwards by conversation
7
 * Retrieves all forwarded conversations based on the unique conversation ID.
8

9
To learn more, see [Forwarding conversations](https://help.kustomer.com/forwarding-SJN_iaACN) in the Kustomer Help Center.
10

11
Any one of the following roles is required for this endpoint:
12

13
|Legacy Role|Equivalent Permission Set Role|
14
|-----|--------|
15
|org.user.draft.read|org.permission.draft.read|
16
 */
17
export async function main(
18
  auth: Kustomer,
19
  id: string,
20
  page: string | undefined,
21
  pageSize: string | undefined,
22
) {
23
  const url = new URL(
24
    `https://api.kustomerapp.com/v1/conversations/${id}/forwards`,
25
  );
26
  for (const [k, v] of [
27
    ["page", page],
28
    ["pageSize", pageSize],
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.apiKey,
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