Skip to content

[NOWEB] GET /api/messages - timestamp range filter (gte + lte combined) not respected #2011

@ogestordev

Description

@ogestordev

Describe the bug

When listing messages from a chat using the GET /api/messages endpoint on the NOWEB engine, combining both filter.timestamp.gte and filter.timestamp.lte filters does not correctly restrict the results to the specified time range.

Messages sent before the gte value and after the lte value are still returned in the response, as if the range boundaries are being ignored when both filters are used simultaneously.

When either filter is used in isolation, the behavior is correct:

  • filter.timestamp.gte alone correctly excludes messages before the given timestamp.
  • filter.timestamp.lte alone correctly excludes messages after the given timestamp.

To Reproduce

  1. Have a chat with messages spread across different timestamps (e.g., messages from yesterday, today morning, and today afternoon).
  2. Call GET /api/messages with both filters set to a narrow window:
GET /api/{session}/chats/{chatId}/messages?filter.timestamp.gte=1712000000&filter.timestamp.lte=1712003600
  1. Observe that the response includes messages outside the [gte, lte] range — both older and newer than the specified interval.

  2. Repeat with only one filter at a time:

GET /api/{session}/chats/{chatId}/messages?filter.timestamp.gte=1712000000
GET /api/{session}/chats/{chatId}/messages?filter.timestamp.lte=1712003600
  1. Observe that each individual filter works correctly.

Expected behavior

When both filter.timestamp.gte and filter.timestamp.lte are provided together, the API should return only messages whose timestamp satisfies the condition:

gte <= message.timestamp <= lte

No messages outside this range should be included in the response.


Actual behavior

Messages outside the specified [gte, lte] window are returned. The combined filter appears to be applied incorrectly — possibly only one of the two conditions is being enforced, or the logical operator between them is OR instead of AND.


Engine

  • NOWEB
  • WEBJS
  • Other

Environment

  • WAHA version: 2026.3.4
  • Deployment: Docker

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions