0

Create Slack integration mapping

by
Published Oct 17, 2025

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.

Script box Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Box = {
3
  token: string;
4
};
5
/**
6
 * Create Slack integration mapping
7
 * Creates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack)
8
by mapping a Slack channel to a Box item.
9

10
You need Admin or Co-Admin role to
11
use this endpoint.
12
 */
13
export async function main(
14
  auth: Box,
15
  body: {
16
    partner_item?: {
17
      type: "channel";
18
      id: string;
19
      slack_workspace_id?: string;
20
      slack_org_id?: string;
21
    };
22
  } & {
23
    box_item: { type: "folder"; id: string };
24
    options?: { is_access_management_disabled?: false | true };
25
  },
26
) {
27
  const url = new URL(`https://api.box.com/2.0/integration_mappings/slack`);
28

29
  const response = await fetch(url, {
30
    method: "POST",
31
    headers: {
32
      "Content-Type": "application/json",
33
      Authorization: "Bearer " + auth.token,
34
    },
35
    body: JSON.stringify(body),
36
  });
37
  if (!response.ok) {
38
    const text = await response.text();
39
    throw new Error(`${response.status} ${text}`);
40
  }
41
  return await response.json();
42
}
43