Two triggers one AI Agent with one simple memory

Hey everyone,

I am using n8n version 1.83.2 and have designed a workflow with the following structure:

  1. Webhook Trigger: Captures initial data and stores it in the Window Buffer Memory node, keyed by a unique customer identifier.​
  2. WhatsApp Trigger: Activated upon receiving a message from the same customer, aiming to retrieve the stored data using the same unique identifier.​

Here is a picture of the flow:

However, upon the WhatsApp trigger execution, I encounter the following error in the ChatModel node:

"Bad request - please check your parameters. Invalid value for ‘content’: expected a string, got null."​

Questions:

  1. Memory Buffer Usage Across Triggers: Can the Window Buffer Memory node maintain context across different triggers within the same workflow, provided they share a common session key? Are there specific configurations required to ensure data persistence and retrieval in such scenarios?
  2. Best Practices: What are the recommended practices for managing and persisting memory across workflows with multiple triggers to maintain context and avoid such errors?

Since you are using the Merge node, it will expect data from both triggers at the same time.

If only one trigger is being activated for each interaction, you can remove the merge node and connect it directly to the AI Agent.

Remember to check if you are using the correct fields in the expressions.

:point_right: If my reply answers your question, please remember to mark it as a solution.

Thank you for the quick answer. I removed the merge still get the same error. I really believed it linked to the Simple memory:

Here you can see that I am receiving data on the second run from whatsapp:

Oh… you are sending an object to a field that expects a string.

Change that {{ $json }} to {{ $json.whatsapp_message }}

Also, make sure you are using the same field names in these nodes, so the AI Agent can reference the same name for both:

It would be good to share your workflow code here.
You can copy and paste it inside a code block.

To create a code block you just have to click here:
image

Your workflow will show up like this:

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