D-API icon

D-API

Interagir com D-API para automação do WhatsApp

Chat → Obter Mensagens

AI-generated

Summary

Retrieve messages from a specific WhatsApp chat session with control over pagination and sorting.

Inputs

  • ID Da Sessão (required) — The unique identifier for the WhatsApp session.
  • ID Do Chat (required) — The unique identifier for the chat whose messages will be retrieved.
  • Campos Adicionais — Optional parameters to customize the results: limit (maximum number of messages to return), page (pagination page number), sortField (field to sort by: timestamp or name), and sortOrder (sorting order: ascending or descending).

Output shape

a list of message objects from the specified chat session.

The returned messages respect the specified limit, page, sortField, and sortOrder parameters if provided. On error, it throws unless 'continueOnFail' is enabled, in which case errors are returned in the output JSON.

Examples

Example 1: Get the latest 50 messages sorted by timestamp descending from a specific chat in a session.

Set 'ID Da Sessão' to your session ID, 'ID Do Chat' to the chat ID, and optionally leave 'Campos Adicionais' empty or adjust limit and sorting as needed.

Discussion