How to Maintain Context in WhatsApp Business Cloud Chats

Hi everyone,

I’m working on a scenario with the WhatsApp Business Cloud to enable chat interactions. Specifically, I’m trying to ensure that when a message is sent to WhatsApp, the entire chat history is included as context for responses—similar to how a ChatGPT session retains prior messages within its token limit.

The actual system behind it (e.g., RAG or a custom GPT knowledge base) isn’t the main concern. I’m just looking for a way to handle and pass the context dynamically, so each response considers the full conversation history rather than treating every message as standalone. In my scenario every message is handled as a fresh start - that’s the problem.

Any tips on storing, retrieving, and managing the chat history for this use case?

Thanks in advance!

  • n8n version: 1.69.2
  • Database (default: SQLite): QLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own, main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): self-hosted in google cloud
  • Operating system: Windows10

When i use postegreSQL as chat memory, I have no issue defining the “Window Context Lenght”, and it works fine.

I would either try:

  • Set it to 999 (big number)
  • Add another tool connected to my postgreSQL database to count number of interaction and set it dynamically into postgreSQL chat memory using $fromAI

How did you realize this. For me its not passing the context of the conversation. It stores every new message as new message with its own “new context” - so the context of just one message

I can’t give you any details, I was using supabase and my project has been desactivated/suppressed.

Well thats not too important regarding the question how you passed the context.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.