> ## Documentation Index
> Fetch the complete documentation index at: https://developer.box.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage Slack integration folder mappings

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = href;
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

This script helps manage the folder mappings between Slack and Box if using Box
as the content store for Slack. It creates a list of current Slack channel and
Box folder mappings and can create or update mappings based on the input csv. This
script maintains all permissions.

For more details, see the [Github repo][1].

## Prerequisites

### Clone script

Clone this GitHub repo or download files from the `/examples` directory

```bash theme={null}
git clone https://github.com/box/boxcli.git
```

### Windows

Install the latest version of [.NET core](https://dotnet.microsoft.com/download).

### MacOS & Linux

Install [PowerShell][pwsh]. Run the `pwsh` command to test the installation.

```bash theme={null}
pwsh
```

Depending on the directory you are
running the command in, the output may differ.
For example:

```bash theme={null}
PowerShell 7.2.5
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /Users/user/repos/boxcli/examples>
```

<message>
  If you encounter issues make sure you installed both
  [dotnet core](https://dotnet.microsoft.com/download) and
  [PowerShell][pwsh].
</message>

### Box CLI Install

Configure and install the Box CLI using the <Link href="/guides/cli">CLI Quickstart Guide</Link>. Make sure the user you use is an admin or co-admin.

### Enterprise configuration

* Configure and [install Box for Slack][install-slack] in the relevant Slack workspaces and organizations.
* Enable Box as the [content layer for Slack][content-layer].

## Run the script

Change the directory to the folder containing the script. In this example, it is the `Integration Mappings` folder.

```pwsh theme={null}
rvb@lab:~/box-cli/examples/Integration Mappings$ pwsh
PowerShell 7.2.4
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /home/rvb/box-cli/examples/Integration Mappings>
```

Run the script with EXTRACT to extract current mappings:

```pwsh theme={null}
./integration-mappings.ps1 -Action EXTRACT
```

or

Run the script with UPDATE to update current mappings:

```pwsh theme={null}
./integration-mappings.ps1 -Action UPDATE
```

or

Run the script with CREATE to create new mappings:

```pwsh theme={null}
./integration-mappings.ps1 -Action CREATE -MappingPath ./mapping_create_example.csv
```

By default, the csv file will save to and load from ./mappings.csv. If you wish to change this location, you can pass in a new path like so:

```pwsh theme={null}
./integration-mappings.ps1 -Action EXTRACT -MappingPath ./mappings_new_location.csv
```

If you don't specify parameters, the script prompts you to enter them.

When creating a mapping on a new channel, you must input a Box folder ID, Slack channel ID, and Slack org ID. You can use a Slack workspace ID in place of the org ID. In that case, you need to replace the csv column header `SlackOrgId` with `SlackWorkspaceId`.

```pwsh theme={null}
Starting Process
Applying new mappings
Output [...]
All bulk input entries processed successfully.
```

## Logs

Logs are stored in a `logs` folder located in the main folder. You have access to these log files:

* `Integration-mappings_all.txt` that contains all log entries.
* `Integration-mappings_errors.txt` that contains only errors.

## Disclaimer

This project is a collection of open source examples and should not be treated as an officially supported product. Use at your own risk and as a source of examples for how to use the Box CLI.

[pwsh]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.2

[install-slack]: https://support.box.com/hc/en-us/articles/360044195313-Installing-and-Using-the-Box-for-Slack-Integration

[content-layer]: https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack

[1]: https://github.com/box/boxcli/tree/main/examples/Integration%20Mappings

<RelatedLinks
  title="RELATED GUIDES"
  items={[
{ label: translate("OAuth 2.0 Auth"), href: "/guides/authentication/oauth2/index", badge: "GUIDE" },
{ label: translate("Using PowerShell Scripts with the Box CLI"), href: "/guides/cli/scripts/powershell-script-templates", badge: "GUIDE" }
]}
/>
