Add the power of the Box AI API to your custom apps at Content Cloud Summit on May 15

Learn more and register!

Create Slack integration mapping

post
https://api.box.com/2.0
/integration_mappings/slack

Creates a Slack integration mapping by mapping a Slack channel to a Box item.

You need Admin or Co-Admin role to use this endpoint.

Request

bearer [ACCESS_TOKEN]
application/json

Request Body

objectin body

The schema for an integration mapping Box item object for type Slack

stringin bodyrequired
"1234567891"

ID of the mapped item (of type referenced in type)

stringin bodyrequired
"folder"

Type of the mapped item referenced in id

Value is always folder

objectin body

The schema for an integration mapping options object for Slack type.

true

Indicates whether or not channel member access to the underlying box item should be automatically managed. Depending on type of channel, access is managed through creating collaborations or shared links.

objectin body

The schema for an integration mapping mapped item object for type Slack.

Depending if Box for Slack is installed at the org or workspace level, provide either slack_org_id or slack_workspace_id. Do not use both parameters at the same time.

stringin bodyrequired
"C12378991223"

ID of the mapped item (of type referenced in type)

stringin bodyrequired
"channel"

Type of the mapped item referenced in id

Value is always channel

stringin bodyrequired
"E1234567"

ID of the Slack org with which the item is associated. Use this parameter if Box for Slack is installed at the org level. Do not use slack_workspace_id at the same time.

stringin bodyrequired
"T12352314"

ID of the Slack workspace with which the item is associated. Use this parameter if Box for Slack is installed at a workspace level. Do not use slack_org_id at the same time.

Response

application/jsonIntegration mapping

Returns the created integration mapping.

application/jsonClient error

Returns a bad_request if an incorrect options was supplied or the Box folder cannot be mapped to this partner_item_id. Error codes:

  • SERVICE_ACCOUNT_IS_NOT_A_COOWNER_OR_OWNER - service account doesn't have co-owner collaboration or is not an owner of the box_item_id,
  • CHANNEL_ALREADY_MAPPED - channel is already mapped to another box_item_id,
  • CHANNEL_NOT_FOUND - channel was not found,
  • CHANNEL_NOT_SUITABLE_FOR_CFS - connect channel, not suitable for Box as Content layer for Slack,
  • BOX_ENTERPRISE_MISMATCH - Box folder must be owned by the enterprise, which is configured to use Box as Content layer for Slack,
  • CFS_DISABLED - Box as Content layer for Slack must be enabled for a provided Slack workspace or organization
  • BOX_FOLDER_EXTERNALLY_OWNED - Box folder must be internally owned to the admin's enterprise,
  • JWT_APP_NOT_AUTHORIZED - JWT authorization error.
application/jsonClient error

Returns a not_found error if the integration mapping could not be found.

application/jsonClient error

An unexpected client error.

post
Create Slack integration mapping
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -X -L POST "https://api.box.com/2.0/integration_mappings/slack" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H 'content-type: application/json' \
     -d '{
          "partner_item": {
              "id": "C987654321",
              "type": "channel",
              "slack_workspace_id": "T5555555"
          },
          "box_item": {
              "id": "123456789",
              "type": "folder"
          }
      }'
Node
const mapping = await client.integrationMappings.createSlackIntegrationMapping({
	partner_item: {
		type: 'channel',
		id: 'C12378991223',
		slack_org_id: 'E1234567'
	},
	box_item: {
		id: '12345',
		type: 'folder',
	}
});
console.log(
    `Slack integration mapping with id ${mapping.id} was created`
);
TypeScript (Beta)
await userClient.integrationMappings.createSlackIntegrationMapping({
  partnerItem: new IntegrationMappingPartnerItemSlack({
    id: partnerItemId,
    slackOrgId: slackOrgId,
  }),
  boxItem: new IntegrationMappingBoxItemSlack({ id: folder.id }),
} satisfies IntegrationMappingSlackCreateRequest);
Python (Beta)
user_client.integration_mappings.create_slack_integration_mapping(IntegrationMappingPartnerItemSlack(id=partner_item_id, slack_org_id=slack_org_id), IntegrationMappingBoxItemSlack(id=folder.id))
.NET (Beta)
await userClient.IntegrationMappings.CreateSlackIntegrationMappingAsync(requestBody: new IntegrationMappingSlackCreateRequest(partnerItem: new IntegrationMappingPartnerItemSlack(id: partnerItemId, slackOrgId: slackOrgId), boxItem: new IntegrationMappingBoxItemSlack(id: folder.Id)));

Response Example

{
  "id": "12345",
  "type": "integration_mapping",
  "box_item": {
    "id": "12345",
    "type": "folder",
    "etag": "1",
    "name": "Contracts",
    "sequence_id": "3"
  },
  "created_at": "2012-12-12T10:53:43-08:00",
  "created_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "integration_type": "slack",
  "is_manually_created": true,
  "modified_at": "2012-12-12T10:53:43-08:00",
  "modified_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "options": {},
  "partner_item": {
    "id": "C12378991223",
    "type": "channel",
    "slack_org_id": "E1234567",
    "slack_workspace_id": "T12352314"
  }
}