TL;DR:
I’m building a WhatsApp chatbot in n8n (via WAHA) and need to store session data (phone, last timestamp, status) to prevent spam replies and allow human takeover mode.
Options:
-
Workflow static data: fast, but may not handle large/high-traffic data safely.
-
Postgres: already in use, but may add latency if checked every trigger.
Not using Redis due to cost/hosting.
Looking for advice on which approach is more efficient and how workflow static data behaves under load.
Hi everyone,
I’m fairly new to n8n and am currently building an automated WhatsApp customer service chatbot using a third-party API (WAHA). I’m trying to decide on the best way to store session data without using Redis.
What I Want to Achieve
I need to store session data containing:
-
Sender’s phone number
-
Last chat timestamp
-
Status (human/bot)
The session data will be used to:
-
Prevent spam replies: if a customer sends multiple short messages within a short time, the bot should reply once instead of replying to each message separately.
-
Human takeover mode: if a conversation is handed over to a human (status = human), the bot should stop replying until the status expires.
Options I’m Considering
Postgres
-
Pros: Already using it for chat history.
-
Cons: Might add latency if I have to query/update session data for every incoming message.
-
Workflow Static Data
-
Pros: Fast and simple.
-
Cons: Docs say it should only store small amounts of data, so it might not scale if many people are chatting at once.
My Current Approach
I’m using workflow static data as an array of sessions:
-
Each session = { phoneNumber, lastTimestamp } (and later status)
-
A Code node checks if another execution is already handling the same sender. If so, it stops the duplicate execution to avoid double replies.
-
I try to clean up old sessions by replacing the array with only newer sessions, but I’m not sure if my JavaScript logic is correct.
My Questions
-
Is my current static data approach efficient and reliable for high traffic?
-
Would using Postgres for session CRUD be better despite the potential latency?
-
How exactly does workflow static data behave with multiple executions and large arrays?
Any advice, examples, or corrections would be greatly appreciated!
I’m building a WhatsApp chatbot in n8n (via WAHA) and need to store session data (phone, last timestamp, status) to prevent spam replies and allow human takeover mode.
Options:
-
Workflow static data: fast, but may not handle large/high-traffic data safely.
-
Postgres: already in use, but may add latency if checked every trigger.
Not using Redis due to cost/hosting.
Looking for advice on which approach is more efficient and how workflow static data behaves under load.
Hi everyone,
I’m fairly new to n8n and am currently building an automated WhatsApp customer service chatbot using a third-party API (WAHA). I’m trying to decide on the best way to store session data without using Redis.
What I Want to Achieve
I need to store session data containing:
-
Sender’s phone number
-
Last chat timestamp
-
Status (human/bot)
The session data will be used to:
-
Prevent spam replies: if a customer sends multiple short messages within a short time, the bot should reply once instead of replying to each message separately.
-
Human takeover mode: if a conversation is handed over to a human (status = human), the bot should stop replying until the status expires.
Options I’m Considering
Postgres
-
Pros: Already using it for chat history.
-
Cons: Might add latency if I have to query/update session data for every incoming message.
-
Workflow Static Data
-
Pros: Fast and simple.
-
Cons: Docs say it should only store small amounts of data, so it might not scale if many people are chatting at once.
My Current Approach
I’m using workflow static data as an array of sessions:
-
Each session = { phoneNumber, lastTimestamp } (and later status)
-
A Code node checks if another execution is already handling the same sender. If so, it stops the duplicate execution to avoid double replies.
-
I try to clean up old sessions by replacing the array with only newer sessions, but I’m not sure if my JavaScript logic is correct.
My Questions
-
Is my current static data approach efficient and reliable for high traffic?
-
Would using Postgres for session CRUD be better despite the potential latency?
-
How exactly does workflow static data behave with multiple executions and large arrays?
Any advice, examples, or corrections would be greatly appreciated!