Skip to content

Feature: Bidirectional emoji reactions #58

@suyash-delegate

Description

@suyash-delegate

Overview

Enable bot to react to messages and receive reactions from users. Lightweight feedback mechanism for quick acknowledgment.

Part of

#59

Prerequisites

Changes

1. Outbox Enhancement (Bot adds reactions)

// In outbox payload
{
  reactions: ["👍", "✅"]  // Bot adds these emojis
}

2. Inbox Enhancement (User reactions)

When user reacts to message:

{
  metadata: {
    type: "reaction",
    reactionEmoji: "👍",
    messageId: "out_abc123"
  }
}

3. Telegram Implementation

  • setMessageReaction API (Bot API 6.3+)
  • Handle message_reaction updates in getUpdates
  • Limited emoji set (Telegram restricts allowed reactions)

4. Database Changes

CREATE TABLE telegram_reactions (
  message_id INTEGER NOT NULL,
  chat_id INTEGER NOT NULL,
  user_id INTEGER,
  emoji TEXT NOT NULL,
  created_at INTEGER NOT NULL,
  PRIMARY KEY (message_id, chat_id, user_id, emoji)
);

5. Multi-Adapter Support

Adapter Implementation
Telegram setMessageReaction + message_reaction updates
Email Not supported (no equivalent)
Web Native reactions (future)
Voice Not supported

Use Cases

  1. Bot acknowledges: Bot reacts ⏳ while processing, then ✅ when done
  2. Quick feedback: User reacts 👍/👎 to bot suggestions
  3. Status tracking: Bot reactions indicate message state (pending/approved/rejected)

Files to Create

  • test/telegram-reactions.test.ts

Files to Update

  • src/db.ts - reactions table
  • src/telegram.ts - reaction sending and receiving

Acceptance Criteria

  • Bot can add reactions to sent messages
  • Bot receives user reactions as inbox entries
  • Works with other features (buttons, replies)
  • Duplicate reactions handled gracefully
  • Tests cover bot→user and user→bot reaction flows
  • Documentation includes allowed emoji list for Telegram

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions