quick-musician-29561
03/29/2024, 7:56 PMjs
workflow.conversation = event.state.session.fullHistory
const messageData = {
date: currentDateTime,
name: workflow.userName,
conversation: workflow.conversation
}
I used it like this, I created a workflow variable called conversation, then stored the full history there
js
workflow.conversation = event.state.session.fullHistory
with setting up hooks first,
Before Incoming Message
js
if (!event.state.session.fullHistory) {
event.state.session.fullHistory = ''
}
event.state.session.fullHistory = event.state.session.fullHistory + `user: ${event.payload.text}` + '\n'
Before Outgoing Message
js
if (!event.state.session.fullHistory) {
event.state.session.fullHistory = ''
}
event.state.session.fullHistory = event.state.session.fullHistory + `bot: ${outgoingEvent.payload.text}` + '\n'