> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/recipe/communication/slackbot-custom-get-member.md).

# Slack チャンネルのメンバー情報一覧を取得する

## **概要**

SlackBot アクションでチャンネルに参加するメンバーの情報一覧を取得するカスタムアクションを構築します。

## **構築手順**

SlackBot アクションから「カスタムアクション」を選択します。

<figure><img src="https://files.readme.io/0368ae4-CustomAction3.png" alt="1439"><figcaption><p>SlackBot アクションのカスタムアクションを選択します</p></figcaption></figure>

選択したアクションに名前を付けます。\
今回は「メンバー一覧取得」というカスタムアクション名にします。\
この名前は、カスタムアクション名の下部分に表示されます。

<figure><img src="https://files.readme.io/802e146-CustomAction4.gif" alt="1439"><figcaption><p>カスタムアクション名を設定します</p></figcaption></figure>

呼び出す API のエンドポイントに基づいて、リクエストの HTTP メソッドを選択します。\
Slack API のドキュメントを確認すると、HTTP メソッドが記載されています。\
今回の場合、`conversations.members`がGET メソッドを使用することを示しています。

<figure><img src="https://files.readme.io/a938ace-CustomAction5.png" alt="1439"><figcaption><p>Slack APIドキュメント:conversations.members</p></figcaption></figure>

HTTP メソッドを選択すると、アクションに関連する入力フィールドが表示されます。

<figure><img src="https://files.readme.io/e4fadcb-CustomAction6.gif" alt="1437"><figcaption><p>HTTP メソッドを選択すると、追加の入力フィールドが表示されます</p></figcaption></figure>

リクエストパスには、`/conversations.members`と入力し、`https://slack.com/api/conversations.members`となるようにします。

<figure><img src="https://files.readme.io/69204ab-CustomAction7.png" alt="1437"><figcaption><p><code>conversations.members</code>のURL エンドポイントを追加します</p></figcaption></figure>

送信するリクエストを定義します。\
このAPIエンドポイントでは、`token`の他に`channel`をパラメーターとして渡す必要があります。

<figure><img src="https://files.readme.io/4d6587c-CustomAction8.png" alt="734"><figcaption><p>Slack API ドキュメント:conversations.membersのArguments</p></figcaption></figure>

{% hint style="success" %}

### token の扱いについて

カスタムアクションでは、認証トークン（例:ID）をあらかじめ付与した状態になります。
{% endhint %}

リクエスト URL パラメーターを設定します。

<figure><img src="https://files.readme.io/e8d0974-CustomAction10.gif" alt="1435"><figcaption><p>キーと値を入力します</p></figcaption></figure>

レスポンスタイプを選択します。\
選択後、レスポンスボディを定義する入力フィールドが表示されます。

<figure><img src="https://files.readme.io/45b6c7b-CustomAction11.gif" alt="1433"><figcaption><p>レスポンスタイプを選択すると、入力フィールドが表示されます</p></figcaption></figure>

レスポンスボディを定義します。\
まず、 Slack API のドキュメントにて、どんなレスポンス構造になっているかを確認します。

<figure><img src="https://files.readme.io/eda48d0-CustomAction12.png" alt="734"><figcaption><p>Slack API ドキュメント:conversations.membersのExample responses</p></figcaption></figure>

次に、Anyflow Embed で同様の"型"と"構造"を再現、定義しデータツリーを作成します。

<figure><img src="https://files.readme.io/32663b4-CustomAction13.gif" alt="1429"><figcaption><p>作成した項目をドラッグ&#x26;ドロップし、構造を定義します。必要な情報のみ定義します。</p></figcaption></figure>

{% hint style="warning" %}

### 定義する項目について

後続の処理の中で使用したい項目のみを定義します。\
ドキュメントに明記されている項目を全て定義する必要はありません。\
ここで定義した項目は、後続の処理で利用可能です。
{% endhint %}

これで SlackBot のカスタムアクションが完成したので、テスト実行をしてみましょう。\
トリガーなしでカスタムアクションを迅速にテストしたい場合は、 Click トリガーを使用してテストします。

<figure><img src="https://files.readme.io/a303b27-CustomAction14.gif" alt="571"><figcaption><p>Slack チャンネルのメンバー情報一覧を取得するカスタムアクションが完成</p></figcaption></figure>

上記アクションをテスト実行した際、アクションに渡された入力をテスト履歴から確認可能です。

<figure><img src="https://files.readme.io/f34416c-CustomAction15.png" alt="1438"><figcaption><p>テスト履歴:入力値</p></figcaption></figure>

また、Slack API から返された詳細な出力値を確認し、API コールが成功したかがどうか確認可能です。

<figure><img src="https://files.readme.io/0b3c704-CustomAction16.png" alt="1439"><figcaption><p>テスト履歴:出力値</p></figcaption></figure>

こちらの呼び出しは成功となりました。


---

# 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-embed.anyflow.jp/recipe/communication/slackbot-custom-get-member.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.
