Best approach for storing WhatsApp messages – MongoDB or Redis

Hi everyone,

I’m building an integration with WhatsApp to handle incoming messages. For temporary storage and message control, I’m considering using either MongoDB or Redis.

The WhatsApp number is being used as the primary ID/key. Our goal is to update an existing record when the key already exists, instead of inserting a new one.

These are the nodes I’m currently testing:

My main questions are:

  1. Do you recommend MongoDB or Redis for this type of intermediate storage?

  2. How would you suggest implementing this within an n8n workflow?

  3. I’m currently using the “Update” operation node for this, but I’m not sure if it’s the best approach. What’s the recommended way to handle the update operation in this scenario?

If you need any extra information about the workflow or node configuration, please let me know and I’ll be happy to share it.

Thanks in advance

Redis

Best if the data is truly temporary (like session state, message queue, rate-limiting, caching).

Super fast for lookups by key (e.g., WhatsApp number).

Has built-in expiration (TTL) support → great for auto-cleanup.

Downside: not ideal if you later need to query across multiple fields or keep history.

MongDB

Better if you want to persist messages longer, or need querying/filtering beyond just the WhatsApp number.

Handles complex structures (JSON-like).

Supports upsert (update-or-insert) natively.

Downside: slower compared to Redis for pure key-based lookups.

My recommendation:

  • If this is really short-term state management for WhatsApp sessions, Redis + SET/GET with TTL is simpler and faster.

  • If you want to retain structured logs/history, go MongoDB + Update One with upsert

1 Like

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