//native
type Clickup = {
token: string;
};
/**
* Update Webhook
* Update a webhook to change the events to be monitored.
*/
export async function main(
auth: Clickup,
webhook_id: string,
body: { endpoint: string; events: string; status: string },
) {
const url = new URL(`https://api.clickup.com/api/v2/webhook/${webhook_id}`);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 168 days ago