SocialMate icon

SocialMate

Control WhatsApp from n8n or an AI agent: send & read messages, look up contacts, manage groups, download media, queue paced batches of personalised messages, and fetch conversation memory (Get AI Context) — all through your self-hosted SocialMate server.

Message → Get AI Context

AI-generated

Summary

Retrieves recent WhatsApp conversation history for a chat as role-mapped messages, a transcript, or both, trimmed to a message limit and approximate token budget. Use it to give an AI agent conversation context before it replies; it requires SocialMate Pro.

Inputs

  • Account Name or ID — Select the WhatsApp account. It can be left empty when the API key is bound to one account; with access to multiple accounts, choose one.
  • Chat ID / Phone Number (required) — The chat to read: a phone number in international format with country code, or a group JID ending in @g.us.
  • Options — Optional context controls: Before Timestamp (Unix Ms) excludes messages at or after that time; Format selects both (default), messages only, or transcript only; Include Timestamps adds ISO timestamps to transcript lines; Max Messages sets the recent-message limit (default 50); Max Tokens sets the approximate context budget (default 4000); Order chooses chronological (default) or newest first.

Output shape

A single object with account, chat, transcript, messages, and meta fields by default.

Format can restrict the response to messages or transcript. Each message is a conversation turn with role, name, content, timestamp, and type, with reactions, poll tallies, and cached media descriptions when available. These are conversation context turns, not delivery records; use Message: Search / List to inspect delivery status.

Links

Discussion