//native
type Miro = {
token: string;
};
/**
* Update webhook subscription
* Updates the status or the callback URL of an existing webhook subscription.Required scope boards:read Rate limiting Level 2
*/
export async function main(
auth: Miro,
subscription_id: string,
body: { callbackUrl?: string; status?: "enabled" | "disabled" },
) {
const url = new URL(
`https://api.miro.com//v2-experimental/webhooks/board_subscriptions/${subscription_id}`,
);
const response = await fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + 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 235 days ago