Skip to content
SocialMate
Knowledge base Developer API & automation

Agent Memory: give your AI a persistent memory

Let your own AI agent save a contact's name and cache media descriptions, so it never re-asks or re-analyzes. Pro.

2 min read Updated July 14, 2026

Agent Memory (Pro) lets the AI agent you connect to SocialMate — through the HTTP API, the n8n node, or MCP — write what it learns back into SocialMate’s local store, so it never has to learn it twice. Two things it can remember: who a contact is, and what a piece of media said. SocialMate stores what your agent produced; it never generates any of it (SocialMate ships no model — AI generation is still coming soon).

Remembering a contact’s name & details

When your agent works out who an unknown number is (“this is Jane from Acme”), save it with one call. The custom name then shows in the Live feed, message history and GET /ai-context — and a WhatsApp contact sync can never overwrite it. If the number was never in the contact list, it is created.

curl -X PATCH http://localhost:3456/v1/accounts/ACCOUNT_ID/contacts/155512300001 
  -H "x-api-key: YOUR_KEY" -H "Content-Type: application/json" 
  -d '{ "customName": "Jane (VIP)", "company": "Acme", "notes": "Prefers WhatsApp over email", "tags": ["vip","lead"] }'

A provided field is saved, null clears it, and an omitted field is left unchanged. Passing a group id returns 400.

Caching a media description (never re-analyze)

Media arrives as ciphertext SocialMate can’t read, and your agent pays to analyze a photo or transcribe a voice note every time it revisits the thread. Instead, analyze it once with your own vision/transcription model, then cache the result:

curl -X PUT http://localhost:3456/v1/accounts/ACCOUNT_ID/media/med_1/context 
  -H "x-api-key: YOUR_KEY" -H "Content-Type: application/json" 
  -d '{ "context": "A signed invoice #A-1001, total $420, due 2026-08-01.", "source": "your-vision-model" }'

From then on that media comes back to any agent already described. Inside GET /ai-context a plain [image] becomes [image: A signed invoice #A-1001, total $420]; on GET /messages and the message webhooks the item carries context and needsContext:false. To find what still needs analyzing, list media with ?hasContext=false. Saving context also fires a media.context_updated webhook.

The whole loop in n8n: a media.discovered Trigger → filter needsContextMedia: Download File → your vision model → Media: Set Context. Import examples/vision-memory-loop.json from the node package to see it wired. Via MCP the same tools are whatsapp_update_contact and whatsapp_set_media_context.

Agent Memory is Pro (feature key agentMemory); a Free key gets 402 license_required. Both writes are local database updates — no WhatsApp traffic, so they consume no send budget and touch no anti-ban limit.

Was this helpful?

Still stuck — open a ticket · Back to all articles

Free forever · no card Download free