//native
type Clickup = {
token: string;
};
/**
* Create a message reaction
* This endpoint creates a message reaction using lower case emoji names.
*/
export async function main(
auth: Clickup,
workspace_id: string,
message_id: string,
body: { reaction: string },
) {
const url = new URL(
`https://api.clickup.com/api/v3/workspaces/${workspace_id}/chat/messages/${message_id}/reactions`,
);
const response = await fetch(url, {
method: "POST",
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 235 days ago