List Email CCs for a Ticket

Returns any users cc'd on the ticket. #### Availability The [CCs and Followers](https://support.zendesk.com/hc/en-us/articles/203690846) feature must be enabled in Zendesk Support. If the feature is not enabled, the default CC functionality is used. In that case, use List Collaborators to list the users cc'ed on the ticket. #### Allowed For * Agents

Script zendesk Verified

by hugo697 ยท 11/7/2023

The script

Submitted by hugo697 Typescript (fetch-only)
Verified 377 days ago
1
type Zendesk = {
2
  username: string;
3
  password: string;
4
  subdomain: string;
5
};
6
/**
7
 * List Email CCs for a Ticket
8
 * Returns any users cc'd on the ticket.
9

10
#### Availability
11

12
The [CCs and Followers](https://support.zendesk.com/hc/en-us/articles/203690846) feature must be enabled in Zendesk Support.
13

14
If the feature is not enabled, the default CC functionality is used. In that case, use List Collaborators to list the users cc'ed on the ticket.
15

16
#### Allowed For
17

18
* Agents
19
 */
20
export async function main(auth: Zendesk, ticket_id: string) {
21
  const url = new URL(
22
    `https://${auth.subdomain}.zendesk.com/api/v2/tickets/${ticket_id}/email_ccs`
23
  );
24

25
  const response = await fetch(url, {
26
    method: "GET",
27
    headers: {
28
      Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
29
    },
30
    body: undefined,
31
  });
32
  if (!response.ok) {
33
    const text = await response.text();
34
    throw new Error(`${response.status} ${text}`);
35
  }
36
  return await response.json();
37
}
38