Skip to content

GetReactionsPayload serializes messageIds as strings, causing validation error and WebSocket disconnect #81

Description

@zephyr-m

Environment

  • maxapi-python: 2.4.0
  • Python: 3.12
  • Client: WebClient

Problem

Calling get_reactions() sends messageIds as strings:

payload={'chatId': -72218689395283, 'messageIds': ['117093598374465578']}

MAX rejects the request:

proto.payload: Expected number at 30 (Ошибка валидации)

After this response, the WebSocket connection is closed. This can interrupt unrelated work such as chat synchronization.

Cause

GetReactionsPayload currently declares:

class GetReactionsPayload(CamelModel):
    chat_id: int
    message_ids: list[str]

Other message payloads and the MAX endpoint expect numeric message IDs.

Expected fix

Change the field to:

message_ids: list[int]

The service method annotation should be changed to list[int] as well.

I verified locally that coercing these IDs to integers produces the expected MessagePack number type

Metadata

Metadata

Assignees

No one assigned

    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