1 |
|
2 | * edit webhook |
3 | * |
4 | */ |
5 | export async function main( |
6 | workspace: string, |
7 | body: { webhook?: string; [k: string]: unknown } |
8 | ) { |
9 | const url = new URL(`${BASE_URL}/api/w/${workspace}/workspaces/edit_webhook`); |
10 |
|
11 | const response = await fetch(url, { |
12 | method: "POST", |
13 | headers: { |
14 | "Content-Type": "application/json", |
15 | Authorization: "Bearer " + WM_TOKEN, |
16 | }, |
17 | body: JSON.stringify(body), |
18 | }); |
19 | if (!response.ok) { |
20 | const text = await response.text(); |
21 | throw new Error(`${response.status} ${text}`); |
22 | } |
23 | return await response.text(); |
24 | } |
25 |
|