Sorry but I’ve looked in this forum for answers, I’ve searched Google, and even tried using the embed AI in n8n, but I can’t seem to find a recent answer to this or figure it out.
I should say that I am brand new to N8N. I’m still in the trial period but I’m excited about its potential.
Problem
I just want to capture a chat session (i.e. an entire conversation session that was executed via the chat widget) and email that conversation to myself. I’ve tried using the memory but obviously, I’m doing something wrong.
Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.
```
<your workflow>
```
That implies to any JSON output you would like to share with us.
Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!
You haven’t really tell what the problem is, rather what you want to get.
I believe the Memory Manager isn’t working because it expects the value of sessionId. As it is connected directly to AI Agent it is not aware of the session ID because AI Agent produces somethingh else.
Moreover, the Chat is not likely to work either as it will respond with the output of the last node in the chain connected to AI Agent, which is in your case Gmail node, as well as it is looking for the property output.
One of the way to resolve the above is to amend the workflow as shown below.
Note that you still need to know when the session has terminated. Otherwise, you will send the email with every reply (albeit the summary of all the previous communications) by AI Agent during the session.
Hello everyone,
I’ve been looking for an answer and actually @ihortom mentioned my actual pain point:
How can I know that a chat session is terminated?
I have a bit more advanced version of @ihortom 's code above. I want to add the conversation history to a G Sheet, however as he says, each message is recorded individually. The Wait node does not meet my expectations, as far as I understand. I tried an IF node where session_id does not exist, which couldn’t get me to the point.
Hi,
If you don’t need to receive it straight away, I would schedule retrieving the conversations once or twice a day.
It’s actually not possible with the chat memory manager (from what I know) and with the window buffer memory. You’d need to store them in an actual DB (e.g Postgres - possibly on Supabase) and retrieve them on a schedule basis.
I’m actually preparing a template to store those conversations and it might get you started.
Let me know if you’re interested.