bumpy-addition-21507
03/01/2024, 12:51 AMfresh-fireman-491
03/01/2024, 6:32 AMbumpy-addition-21507
03/01/2024, 2:57 PMconst DateTime = luxon.DateTime.now().setZone('America/New_York').toFormat('dd-MM-yyyy @ HH:mm:ss')
const currFlow = 'chat-flow'
const lastNode = 'antes-de-flow'
if (workflow.userSessionId != -1) {
if (!workflow.userPathToNow[currFlow]) {
workflow.userPathToNow[currFlow] = []
}
workflow.userPathToNow[currFlow].push(lastNode)
const updateRecord = {
usageEnds: DateTime,
lastFlowVisited: currFlow,
lastInteractionNode: lastNode,
userPathDetails: workflow.userPathToNow
}
const updateRecordSuccess = await UserPathTable.updateRecord(workflow.userSessionId, updateRecord)
} else {
workflow.userPathToNow[currFlow] = [lastNode]
const newRecord = {
userId: parseInt(user.userId),
userName: user.userName_api,
usageEnds: DateTime,
lastFlowVisited: currFlow,
lastInteractionNode: lastNode,
userPathDetails: workflow.userPathToNow
}
const createdRecord = await UserPathTable.createRecord(newRecord)
workflow.userSessionId = createdRecord.id
}
I should note that this has been working just fine until recently, I didn't change anything rather, people who hadn't spoken to the bot for a while talked to it and the error was triggered.
Also, I have a default variable created with value to -1 if there is none availablefresh-fireman-491
03/04/2024, 8:36 AMfresh-fireman-491
03/04/2024, 8:43 AM