//native
type Smartsheet = {
token: string;
baseUrl: string;
};
/**
* Delete Webhook
* Deletes the specified Webhook.
Using this operation permanently deletes the specified webhook.
To temporarily disable a webhook, use the Update Webhook operation to set **enabled** to **false**.
*/
export async function main(
auth: Smartsheet,
webhookId: string,
) {
const url = new URL(`${auth.baseUrl}/webhooks/${webhookId}`);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago