0

Update team routing settings

by
Published Oct 17, 2025

Updates a team's routing settings by its unique team ID.

Script kustomer Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Kustomer = {
3
  apiKey: string;
4
};
5
/**
6
 * Update team routing settings
7
 * Updates a team's routing settings by its unique team ID.
8
 */
9
export async function main(
10
  auth: Kustomer,
11
  id: string,
12
  body: {
13
    queues?: string[];
14
    externalQueues?: "amazon-connect"[];
15
    enabled?: false | true;
16
    workItemCapacity?: number;
17
    capacity?: {};
18
  },
19
) {
20
  const url = new URL(`https://api.kustomerapp.com/v1/routing/settings/${id}`);
21

22
  const response = await fetch(url, {
23
    method: "PUT",
24
    headers: {
25
      "Content-Type": "application/json",
26
      Authorization: "Bearer " + auth.apiKey,
27
    },
28
    body: JSON.stringify(body),
29
  });
30
  if (!response.ok) {
31
    const text = await response.text();
32
    throw new Error(`${response.status} ${text}`);
33
  }
34
  return await response.json();
35
}
36