0

Update Web Hook

by
Published Oct 17, 2025

Updates a web hook based on the ID. ### Debugging Set the debug param to true to enable web hook debugging. Setting debug to true will enable monitoring of inbound hook transactions for 24 hours. See Get Web Hook Transactions for more details.

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 Web Hook
7
 * Updates a web hook based on the ID.
8

9
### Debugging
10
Set the debug param to true to enable web hook debugging.  Setting debug to true will enable monitoring of inbound hook transactions for 24 hours.  See Get Web Hook Transactions for more details.
11
 */
12
export async function main(
13
  auth: Kustomer,
14
  id: string,
15
  body: { debug?: false | true; description?: string; title?: string },
16
) {
17
  const url = new URL(`https://api.kustomerapp.com/v1/hooks/web/${id}`);
18

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