← Back to Plugins
Tools

Bot Mention Dispatcher

paskaa By paskaa 👁 62 views ▲ 0 votes

OpenClaw plugin for bot-to-bot mention dispatch in Feishu

GitHub

Configuration Example

const BOT_OPEN_ID_MAP = {
  "ou_xxxxxxxx": "agent_id_1",  // Bot 1
  "ou_yyyyyyyy": "agent_id_2",  // Bot 2
};

README

# Bot Mention Dispatcher

OpenClaw plugin that enables bot-to-bot communication through @mentions in Feishu group chats.

## Problem

When bot A sends a message with `@BotB` in a Feishu group chat, BotB does not receive a callback. This is a platform limitation in Feishu - bots cannot trigger other bots through mentions to prevent infinite loops.

## Solution

This plugin intercepts messages sent by bots and dispatches them to other mentioned bots:

1. Bot A receives a user request to mention another bot
2. Bot A sends a message with `@BotB` to the group
3. This plugin intercepts the `message_sent` event
4. Plugin parses the message content for bot mentions
5. Plugin directly invokes BotB's agent with the message context
6. BotB responds in the same conversation

## Installation

```bash
cd ~/.openclaw/extensions
git clone https://github.com/paskaa/openclaw-bot-mention-dispatcher.git bot-mention-dispatcher
```

## Configuration

Add bot Open ID mappings in `handler.js`:

```javascript
const BOT_OPEN_ID_MAP = {
  "ou_xxxxxxxx": "agent_id_1",  // Bot 1
  "ou_yyyyyyyy": "agent_id_2",  // Bot 2
};
```

### Finding Bot Open IDs

1. Get tenant access token:
```bash
curl -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
  -H "Content-Type: application/json" \
  -d '{"app_id":"YOUR_APP_ID","app_secret":"YOUR_APP_SECRET"}'
```

2. Get bot info:
```bash
curl -X GET "https://open.feishu.cn/open-apis/bot/v3/info" \
  -H "Authorization: Bearer YOUR_TENANT_TOKEN"
```

## Hook Configuration

The plugin uses the `message_sent` hook. See `HOOK.md` for details.

## Agent Configuration

Ensure each bot account has proper group access:

```json
{
  "groupPolicy": "mention",
  "groupAllowFrom": ["*"]
}
```

## Example Usage

**User (in group):** `@刘备 通知关羽处理bug`

**刘备:** Sends message `@关羽 请处理这个bug`

**Plugin:** Intercepts and triggers 关羽's agent

**关羽:** Responds in the group with the bug fix

## Limitations

- Only works with OpenClaw-managed bots
- Requires proper Open ID mapping configuration
- Message context is passed but original sender info may vary

## License

MIT
tools

Comments

Sign in to leave a comment

Loading comments...