# Configure Feishu message sending

Create a Feishu custom app and a message-sending instance in MOI so an agent can send messages through the app.

(prepare-feishu-app)=

## Prepare a Feishu app

You need permission to create or manage a custom app for your organization. Otherwise, ask a Feishu administrator to create it and provide the credentials.

### 1. Create the app and add a bot

Sign in to the [Feishu developer console](https://open.feishu.cn/app), select the action to create a custom app, and enter its name, description, and icon. Open an existing app if suitable.

Open the app-capabilities page and select **Add** on the **Bot** card.

### 2. Copy credentials

Under credentials and basic information, copy **App ID** and **App Secret**. Then open **Events and callbacks → Encryption policy** and copy **Verification Token**. The current MOI message-sending form requires this field. All values must come from the same app.

### 3. Configure permissions and publish

In permission management, request the permissions required by the [Feishu send-message API](https://open.feishu.cn/document/server-docs/im-v1/message/create). Create and publish an app version under version management and publishing. Confirm that the test user is in the app's availability scope. Republish as directed after adding permissions.

## Create the MOI instance

1. Open **Resource Center → Tools → Feishu**.
2. Select **Add → Message sending**.
3. Enter the app credentials and instance information below.
4. Save and test the connection.
5. Bind the instance to the target agent, request a message to a test user or group, and confirm receipt in Feishu.

| MOI field | Value |
| --- | --- |
| Tool instance name | A name such as “Team Feishu messages” |
| Description | Optional description of the sending scope |
| App ID | The Feishu app's identifier |
| App Secret | The secret from the same app |
| Verification Token | The same app's value under Events and callbacks → Encryption policy |
| Connection timeout (seconds) | Optional; default 30 |

## Troubleshoot

| Symptom | Check |
| --- | --- |
| App authentication failed | App ID, App Secret, and Verification Token all belong to the same app |
| Sending failed | Permissions, publication state, availability scope, and bot membership in the target group |
| Saved but not callable | The target agent is bound to the newly created, tested message-sending instance |

- [Feishu configuration](../feishu.md)
