//native
type Miro = {
token: string;
};
/**
* Create webhook subscription
* Creates a webhook subscription to receive notifications when an item on a board is updated. Subscriptions are created per user, per board. You can create multiple subscriptions. We currently support all board items except tags, connectors, and comments.Required scope boards:read Rate limiting Level 2
*/
export async function main(
auth: Miro,
body: {
boardId?: string;
callbackUrl?: string;
status?: "enabled" | "disabled";
},
) {
const url = new URL(
`https://api.miro.com//v2-experimental/webhooks/board_subscriptions`,
);
const response = await fetch(url, {
method: "POST",
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