Chat History In Array
# 🤝help
a
I'm trying to export the chat history into an array variable that saves both the bot's and the users' messages. However, I'm only able to store the last 6 interactions. Any hints? I need to export the entire chat.
c
how could you find the last 6 interactions?
i have similer problem, need to export the history chat
a
tried these (like it says in the chat support (didnt work): workflow.userHistoryArr.push({user_said:event.preview}) workflow.userHistoryArr.push({bot_replied:workflow.answer}) so i tried these: workflow.chatHistory = [] event.state.session.history.map((message) => { { workflow.chatHistory.push(${message.sender}:${message.preview}) } }) but im just getting 6 elements Any clue?
c
did u run the code i excude code ?
a
no, how is it?
c
where did u run the cod to get the 6 elements ?
a
In an execute code card
c
aha okej
what are you trying to archive ?
with chat history
a
I want the whole chat history, export it as an array (bot an user) so i can uset in a database (firestore)
the only way that i have found its export the {{conversation.SummaryAgent.transcript}}
but it export it as a single string (not as an array)
@early-train-33247 any suggestions? I just read a post from you, but i dont know how to implement a before incoming hook and a before outgoing hook. Can you helpme please? 🙏
l
hi were you able to do so
e
Hey folks, we now have the history available in the
event.state.session.fullHistory
variable
check out the hooks tab to see how this custom variable is populated

https://cdn.discordapp.com/attachments/1132795803166064640/1141911176394051735/image.png