0

Set chat settings

by
Published Oct 17, 2025

Sets the display options for the chat channel. Any one of the following roles is required for this endpoint: |Legacy Role|Equivalent Permission Set Role| |-----|--------| |org.admin.apps.write|org.permission.apps.update|

Script kustomer Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Kustomer = {
3
  apiKey: string;
4
};
5
/**
6
 * Set chat settings
7
 * Sets the display options for the chat channel.
8

9
Any one of the following roles is required for this endpoint:
10

11
|Legacy Role|Equivalent Permission Set Role|
12
|-----|--------|
13
|org.admin.apps.write|org.permission.apps.update|
14
 */
15
export async function main(
16
  auth: Kustomer,
17
  body: {
18
    teamName?: string;
19
    teamIconUrl?: string;
20
    greeting?: string;
21
    autoreply?: string;
22
    embedIconUrl?: string;
23
    embedIconColor?: string;
24
    fallbackFromEmail?: string;
25
    offhoursDisplay?: "online" | "offline" | "none";
26
    offhoursMessage?: string;
27
    offhoursImageUrl?: string;
28
    volumeControl?: {
29
      enabled?: false | true;
30
      mode?: "delayed" | "upfront";
31
      markDoneAfterTimeout?: false | true;
32
      useDynamicWaitMessage?: false | true;
33
      promptDelay?: number;
34
      upfrontWaitThreshold?: number;
35
      timeout?: number;
36
      followUpChannels?: "email" | "sms" | "voice"[];
37
      hideWaitOption?: false | true;
38
      customWaitMessage?: string;
39
    };
40
    singleSessionChat?: false | true;
41
    closableChat?: false | true;
42
    noHistory?: false | true;
43
    activeForm?: string;
44
    domainCriteria?: { and?: {}[]; or?: {}[] };
45
    enabled?: false | true;
46
    showBrandingIdentifier?: false | true;
47
    showTypingIndicatorWeb?: false | true;
48
    showTypingIndicatorCustomerWeb?: false | true;
49
  },
50
) {
51
  const url = new URL(`https://api.kustomerapp.com/v1/chat/settings`);
52

53
  const response = await fetch(url, {
54
    method: "PATCH",
55
    headers: {
56
      "Content-Type": "application/json",
57
      Authorization: "Bearer " + auth.apiKey,
58
    },
59
    body: JSON.stringify(body),
60
  });
61
  if (!response.ok) {
62
    const text = await response.text();
63
    throw new Error(`${response.status} ${text}`);
64
  }
65
  return await response.json();
66
}
67