How to access full chat transcript when using n8n chat package?

I have a workflow that uses lang chain and conversational agent to chat with a site visitor using the n8n chat package. As part of the chat the AI asks for the persons email address, and if supplied that is captured to a crm.

How can I capture the entire chat transcript in order to be able to push that to a CRM to be included in an email to the visitor?

The Conversational Agent out put is only the most recent AI reply. I can see the full transcript in the agent logs but I don’t see a way to work with that data?

Please share your workflow

Information on your n8n setup

  • n8n version: latest beta self hosted
  • Database (default: SQLite): SQ lite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: linux

Hey @Robm,

That is a good question, I am not acutally sure. @oleg do you have any thoughts on this one?

Apologies for bumping this but does any one have any suggestions?

@oleg ?

Hi @Robm, the Memory Chat Retriever should be able to do this. You need to make sure to set the same memory key for both agent memory and retriever node


1 Like

Thanks @oleg

I have found the Chat retriever node but I don’t see anywhere in that node’s configuration to add the session id. There is only a single setting “Simplify output”.

I assume that when you referred to “memory key” you mean’t session ID?

I did add windows buffer memory to the node and the node executes with out error but with no output.

Figured it out, add the session ID as a token in the windows memory buffer.

2 Likes

@oleg - follow on question, not sure if this should be a new topic?

The chat retriever outputs data like this

[
  {
    "human": "Morning Alex",
    "ai": "Thanks for reaching out! May I know your email address so that I can email you any information you may find useful?"
  },
  {
    "human": "[email protected]",
    "ai": "Thanks for providing your email address. Now, how can I assist you with Member Track today?"
  },
  {
    "human": "What does member track do?",
    "ai": "Thanks Alex, Member Track is a powerful open-source marketing automation software. It helps you to engage with, nurture, and track leads through every stage of your sales funnel. With Member Track, you can create and implement marketing campaigns, track user interactions, score leads, and do much more. It's like having a personal assistant for your marketing team! Do you have any specific questions about how to use Member Track?"
  },
  {
    "human": "yes i do",
    "ai": "Thanks Alex, I'm glad to hear that you're interested in learning more about Member Track! Please feel free to ask your specific questions, and I'll do my best to provide you with the information you need."
  },
  {
    "human": "What does it cost?",
    "ai": "Thanks Alex, I'm sorry but I couldn't find specific information on the cost of Member Track. As it's an open-source software, it's generally free to use. However, costs can be associated with customization, hosting, or professional services if you choose to use them. I recommend checking the official Member Track website or contacting their support for the most accurate and up-to-date information. Do you have any other questions about Member Track?"
  }
]

I need to be able grab the entire conversation conversation as a single Object (I hope I am using this term correctly). This is so I can grab the entire conversation and set as a body for an email node or insert into a text block in a crm.

The output currently is broken up into Human and ai. This makes it challenging to configure the next node. I would need to have an expression for every single question and answer and I would not know how many questions and answer there would be as each conversation length would be different.

I have tried using the set node to concatenate the conversation, and this kinda works in that the entire conversation is collapsed into 2 objects - Human and AI. But it breaks the flow of reading the natural flow of the conversation, ie all the AI answers are in one object, and all the human questions are in another.

I hope I am making sense?

@Robm Glad to hear, you’ve managed to get it to work! :smiling_face:
You could use the Item Lists node to merge the results into a single object and then you can transform that object and generate HTML for an email. Here’s a quick example:

It produces email like this:

Hope that works for your use-case!

1 Like

Amazing, that did the job!

Much appreciated!

1 Like

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