> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/maiagent-user-guide/maiagent-user-guide-ja/conversations/slack.md).

# 対話プラットフォーム連携：Slack

## 連携前の確認 <a href="#pre-integration-checklist" id="pre-integration-checklist"></a>

* [MaiAgent プラットフォーム](https://admin.maiagent.ai/)上で「AI アシスタント」を 1 つ作成済みであること
* Slack ワークスペース（Workspace）の管理者権限を保有していること

## ステップ 1：Slack App を作成する <a href="#step-create-slack-app" id="step-create-slack-app"></a>

### 1. Slack API にアクセスして App を作成する <a href="#step-go-to-slack-api" id="step-go-to-slack-api"></a>

<https://api.slack.com/apps> にアクセスし、<mark style="color:blue;">Create an App</mark> をクリックします。

<figure><img src="/files/daZxz3C6gkFkjr6DipKD" alt=""><figcaption><p>Slack API — Your Apps ページ</p></figcaption></figure>

### 2. From scratch を選択する <a href="#step-create-from-scratch" id="step-create-from-scratch"></a>

<mark style="color:blue;">From scratch</mark> を選択し、グラフィカルなインターフェースで手動設定を行います。

<figure><img src="/files/Z11dY23WzUv9Jco70M3R" alt=""><figcaption><p>作成方法として From scratch を選択</p></figcaption></figure>

### 3. App 名とワークスペースを入力する <a href="#step-fill-app-name-and-workspace" id="step-fill-app-name-and-workspace"></a>

App 名（例：`MaiAgentBot`）を入力し、インストール先の Slack ワークスペースを選択して、<mark style="color:blue;">Create App</mark> をクリックします。

<figure><img src="/files/9ydtqxcPyDXA7bVhoscK" alt=""><figcaption><p>App 名を入力しワークスペースを選択</p></figcaption></figure>

### 4. Signing Secret を取得する <a href="#step-get-signing-secret" id="step-get-signing-secret"></a>

作成が完了したら <mark style="color:blue;">Basic Information</mark> ページに進み、**App Credentials** セクションで <mark style="color:blue;">Signing Secret</mark> を見つけ、<mark style="color:blue;">Show</mark> をクリックしてコピーし、控えておきます。

<figure><img src="/files/FzfBrNDkhkvoHBR81siY" alt=""><figcaption><p>App Credentials — Signing Secret をコピー</p></figcaption></figure>

***

## ステップ 2：Bot の権限を設定する <a href="#step-configure-bot-permissions" id="step-configure-bot-permissions"></a>

### 1. OAuth & Permissions に進む <a href="#step-go-to-oauth-permissions" id="step-go-to-oauth-permissions"></a>

左側のメニューで <mark style="color:blue;">OAuth & Permissions</mark> をクリックします。

<figure><img src="/files/b7XyLLRInpUxocrXQZqw" alt=""><figcaption><p>OAuth &#x26; Permissions ページ</p></figcaption></figure>

### 2. Bot Token Scopes を追加する <a href="#step-add-bot-token-scopes" id="step-add-bot-token-scopes"></a>

下にスクロールして **Bot Token Scopes** セクションまで移動し、<mark style="color:blue;">Add an OAuth Scope</mark> をクリックして、以下の権限を順に追加します。

| Scope               | 説明                        |
| ------------------- | ------------------------- |
| `app_mentions:read` | ボットに @ メンションされたメッセージを読み取る |
| `channels:history`  | パブリックチャンネルのメッセージ履歴を読み取る   |
| `chat:write`        | メッセージを送信する                |
| `files:read`        | ファイル（画像／ドキュメント）を読み取る      |
| `groups:history`    | プライベートチャンネルのメッセージ履歴を読み取る  |
| `im:history`        | ダイレクトメッセージのメッセージ履歴を読み取る   |
| `mpim:history`      | グループダイレクトメッセージの履歴を読み取る    |

<figure><img src="/files/pyxl9ajP8D8EKkfkypEa" alt=""><figcaption><p>Bot Token Scopes の権限設定</p></figcaption></figure>

### 3. App をワークスペースにインストールする <a href="#step-install-app-to-workspace" id="step-install-app-to-workspace"></a>

ページ上部までスクロールして戻り、<mark style="color:blue;">Install to Workspace</mark>（または Reinstall to Workspace）をクリックします。

<figure><img src="/files/vRzYi0PKsMwYNCafZ96c" alt=""><figcaption><p>Install App ページ</p></figcaption></figure>

Slack が認可ページに遷移するので、権限を確認したうえで <mark style="color:blue;">許可する</mark> をクリックします。

<figure><img src="/files/B3YujZFIRbvZbYoGiEfm" alt=""><figcaption><p>App によるワークスペースへのアクセスを認可</p></figcaption></figure>

### 4. Bot User OAuth Token をコピーする <a href="#step-copy-bot-user-oauth-token" id="step-copy-bot-user-oauth-token"></a>

インストールが完了したら <mark style="color:blue;">OAuth & Permissions</mark> ページに戻り、<mark style="color:blue;">Bot User OAuth Token</mark>（形式は `xoxb-...`）をコピーします。

<figure><img src="/files/sMCiXgNQv62SCOMmHCvu" alt=""><figcaption><p>Bot User OAuth Token をコピー</p></figcaption></figure>

***

## ステップ 3：App Home を設定する（ダイレクトメッセージを有効化） <a href="#step-configure-app-home" id="step-configure-app-home"></a>

左側のメニューから <mark style="color:blue;">App Home</mark> ページに進み、**Show Tabs** セクションで以下を行います。

1. <mark style="color:blue;">Messages Tab</mark> を有効にする
2. <mark style="color:blue;">Allow users to send Slash commands and messages from the messages tab</mark> にチェックを入れる

<figure><img src="/files/OWdgyuScg3UHV3m82K3A" alt=""><figcaption><p>Messages Tab を有効にして、ユーザーが Bot にダイレクトメッセージを送れるようにする</p></figcaption></figure>

{% hint style="warning" %}
このステップは必ず完了させてください。完了しないと、ユーザーはダイレクトメッセージで Bot と対話できません。
{% endhint %}

***

## ステップ 4：MaiAgent で Slack 対話プラットフォームを作成する <a href="#step-create-slack-channel-in-maiagent" id="step-create-slack-channel-in-maiagent"></a>

### 1. 対話プラットフォーム連携に進む <a href="#step-go-to-channel-integration" id="step-go-to-channel-integration"></a>

MaiAgent の左側メニューで <mark style="color:blue;">対話プラットフォーム</mark> をクリックし、右上の <mark style="color:blue;">対話プラットフォームを連携</mark> をクリックして、<mark style="color:blue;">Slack</mark> を選択します。

<figure><img src="/files/6l6fNNVuUaysa0bnwRkc" alt=""><figcaption><p>MaiAgent の Slack 連携設定画面</p></figcaption></figure>

### 2. 基本設定を入力する <a href="#step-fill-basic-settings" id="step-fill-basic-settings"></a>

| 項目                       | 説明                                      |
| ------------------------ | --------------------------------------- |
| **名称**                   | この連携に名前を付けます（必須）                        |
| **AI アシスタント**            | 紐付ける AI アシスタントを選択します                    |
| **Bot User OAuth Token** | ステップ 2 で取得した Bot Token を貼り付けます（必須）      |
| **Signing Secret**       | ステップ 1 で取得した Signing Secret を貼り付けます（必須） |

### 3. 認証情報を検証する <a href="#step-verify-credentials" id="step-verify-credentials"></a>

<mark style="color:blue;">認証情報を検証</mark> ボタンをクリックし、Token と Secret が正しいことを確認します。

### 4. チャットルーム設定 <a href="#step-chat-room-settings" id="step-chat-room-settings"></a>

| 設定                            | 説明                                         |
| ----------------------------- | ------------------------------------------ |
| **グループでは @ メンションされた場合のみ応答する** | 有効にすると、Bot はグループチャンネルで @ メンションされたときのみ応答します |
| **リセットコマンドを有効にする**            | 有効にすると、ユーザーはコマンドで対話を最初からやり直せます             |

### 5. 保存して Webhook URL を取得する <a href="#step-save-and-get-webhook-url" id="step-save-and-get-webhook-url"></a>

<mark style="color:blue;">対話プラットフォームを連携</mark> をクリックして作成を完了します。システムが **Webhook URL** を生成しますので、コピーして控えておいてください。

***

## ステップ 5：Slack App に戻って Event Subscriptions を設定する <a href="#step-configure-event-subscriptions" id="step-configure-event-subscriptions"></a>

### 1. Events を有効にする <a href="#step-enable-events" id="step-enable-events"></a>

Slack App の左側メニューで <mark style="color:blue;">Event Subscriptions</mark> をクリックし、<mark style="color:blue;">Enable Events</mark> をオンにします。

<figure><img src="/files/krmwZn91slSayndlBDEb" alt=""><figcaption><p>Event Subscriptions 設定ページ</p></figcaption></figure>

### 2. Request URL を貼り付ける <a href="#step-paste-request-url" id="step-paste-request-url"></a>

MaiAgent が生成した **Webhook URL** を <mark style="color:blue;">Request URL</mark> 欄に貼り付けます。Slack が自動的に検証を行い、<mark style="color:green;">Verified ✓</mark> と表示されれば設定成功です。

<figure><img src="/files/Cym43dW4LTKagJCNTvy3" alt=""><figcaption><p>Request URL の検証成功</p></figcaption></figure>

### 3. Bot Events を購読する <a href="#step-subscribe-bot-events" id="step-subscribe-bot-events"></a>

**Subscribe to bot events** セクションを展開し、<mark style="color:blue;">Add Bot User Event</mark> をクリックして、以下のイベントを追加します。

| Event              | 説明                      |
| ------------------ | ----------------------- |
| `message.im`       | ダイレクトメッセージ内の新着メッセージ     |
| `message.channels` | パブリックチャンネル内の新着メッセージ     |
| `message.groups`   | プライベートチャンネル内の新着メッセージ    |
| `message.mpim`     | グループダイレクトメッセージ内の新着メッセージ |
| `app_mention`      | チャンネル内で @ メンションされる      |

<figure><img src="/files/crIrMEiVI0Ta5gCKTPt1" alt=""><figcaption><p>Bot Events を購読</p></figcaption></figure>

### 4. 変更を保存する <a href="#step-save-changes" id="step-save-changes"></a>

<mark style="color:blue;">Save Changes</mark> をクリックして設定を完了します。

{% hint style="warning" %}
保存後、Slack から App の再インストールを求められる場合があります。新しい権限を適用するため、ページ上部の案内をクリックして再インストールしてください。
{% endhint %}

***

## 利用を開始する <a href="#getting-started" id="getting-started"></a>

連携が完了すると、以下の方法で AI アシスタントと対話できます。

### ダイレクトメッセージでの対話 <a href="#direct-message-conversation" id="direct-message-conversation"></a>

Slack で Bot に直接ダイレクトメッセージを送ると、AI アシスタントが自動的に返信します。テキスト、画像、ファイルの送信に対応しています。

<figure><img src="/files/8wBMoAClW1oPWyFq6aJS" alt=""><figcaption><p>Slack のダイレクトメッセージ対話 — AI アシスタントが自動返信（画像認識に対応）</p></figcaption></figure>

### ファイルのアップロードと分析 <a href="#file-upload-and-analysis" id="file-upload-and-analysis"></a>

ユーザーは対話の中で Excel や PDF などのファイルをアップロードでき、AI アシスタントはファイルの内容を読み取って関連する質問に回答できます。

<figure><img src="/files/wdFgMEWEOEHzDR3buBhH" alt=""><figcaption><p>Excel ファイルをアップロードすると、AI アシスタントが自動的に内容を分析</p></figcaption></figure>

### チャンネルでの @ メンション <a href="#channel-mention" id="channel-mention"></a>

チャンネル内で `@Bot名 質問内容` のように入力すると、AI アシスタントがチャンネル内で返信します。

{% hint style="info" %}
Bot を特定のチャンネルに追加するには、そのチャンネルで `/invite @Bot名` と入力するか、チャンネル設定 → インテグレーション → アプリを追加 から追加してください。
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.maiagent.ai/maiagent-user-guide/maiagent-user-guide-ja/conversations/slack.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
