//native
type Box = {
token: string;
};
/**
* Create Slack integration mapping
* Creates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack)
by mapping a Slack channel to a Box item.
You need Admin or Co-Admin role to
use this endpoint.
*/
export async function main(
auth: Box,
body: {
partner_item?: {
type: "channel";
id: string;
slack_workspace_id?: string;
slack_org_id?: string;
};
} & {
box_item: { type: "folder"; id: string };
options?: { is_access_management_disabled?: false | true };
},
) {
const url = new URL(`https://api.box.com/2.0/integration_mappings/slack`);
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