Skip to content

feat(feishu): add reaction support and group mention gating#59

Open
VanwaysAI wants to merge 1 commit into
OpenBMB:mainfrom
VanwaysAI:feature/feishu-reaction-support
Open

feat(feishu): add reaction support and group mention gating#59
VanwaysAI wants to merge 1 commit into
OpenBMB:mainfrom
VanwaysAI:feature/feishu-reaction-support

Conversation

@VanwaysAI
Copy link
Copy Markdown

Summary

Add Feishu reaction support for message processing status and group mention gating.

Features

Processing Status Indicators

  • Add Typing reaction when receiving user messages (indicates processing)
  • Remove Typing reaction after processing completes
  • Add CrossMark reaction on processing failure

Group Chat Mention Gating

  • Only respond to group messages when bot is @mentioned
  • Fetch bot open_id via Bot Info API for accurate mention detection
  • Avoid false triggers from mentions of other bots
  • Private chat messages always respond

Reaction Event Subscriptions

  • Subscribe to im.message.reaction.created_v1 and im.message.reaction.deleted_v1
  • Support both Webhook and WebSocket event delivery
  • Filter bot/app's own reactions to avoid feedback loops

Technical Details

New API Endpoints

  • GET /open-apis/bot/v3/info - Fetch bot info (open_id)
  • POST /open-apis/im/v1/messages/{message_id}/reactions - Add reaction
  • DELETE /open-apis/im/v1/messages/{message_id}/reactions/{reaction_id} - Remove reaction

New Methods

  • _fetchBotInfo() - Fetch bot open_id on startup
  • _isMentioningBot() - Check if mentions include this bot
  • _addReaction() / _removeReaction() - Manage reactions
  • _onReactionEvent() - Handle incoming reaction events

Constants

const FEISHU_REACTION_IN_PROGRESS = "Typing";
const FEISHU_REACTION_FAILURE = "CrossMark";

Testing

  • Typing reaction shown when processing messages
  • Typing reaction removed after processing
  • CrossMark reaction shown on failure
  • Group messages without @mention are ignored
  • Group messages with @mention are processed
  • Private chat messages always processed
  • Reaction events are received and logged

Breaking Changes: None

Dependencies: None

- Add Typing reaction when processing user messages
- Remove Typing reaction after processing completes
- Add CrossMark reaction on processing failure
- Subscribe to im.message.reaction.created_v1 and deleted_v1 events
- Add group chat mention gating: only respond when bot is @mentioned
- Fetch bot open_id on startup for accurate mention detection
- Filter bot's own reactions to avoid feedback loops
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant