Skip to content

feat: Handle Telegram user blocking/chat deletion errors in consumer #168

@LeonardoVieira1630

Description

@LeonardoVieira1630

Context

When a Telegram user deletes their chat with the bot or blocks the bot, the dispatcher continues sending messages to that user. When these messages reach the consumer and it tries to send them via Telegram, it fails with specific errors. Currently, these errors are not properly handled, causing issues in the message processing flow.

Objective

Implement proper error handling in the Telegram consumer to detect when users have blocked the bot or deleted the chat, and automatically mark these users as inactive in the database.

Technical Requirements

  1. Error Detection in Consumer:

    • Catch and identify specific Telegram errors:
      • 403: Forbidden: bot was blocked by the user
      • 403: Forbidden: bot was kicked from the chat
      • 400: Bad Request: chat not found
      • 400: Bad Request: group is deactivated
  2. User Deactivation Flow:

    • When these errors are detected, make an HTTP call to subscription-server
    • Update the user's active status to false in the database
    • Log the deactivation event for monitoring
  3. Subscription Server Endpoint:

    • Create endpoint to handle user deactivation requests
    • Update user's active status in database
    • Return confirmation to consumer

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions