botSession
Stored in the botsessions collection. createdAt and updatedAt are maintained automatically.
Returned by GET /conversation/handover, PUT /conversation/intercept, GET /manual-chatbot/chatbot-router/session/stop, PUT /manual-chatbot/chatbot-router/session/stop.
| Field | Type | Notes |
|---|---|---|
company | ObjectId -> Company | required |
channel | string | required · one of webchat, whatsapp, instagram |
app | ObjectId | required |
account | ObjectId | default null |
externalThreadId | string | required |
entryPoint | ObjectId | default null |
contact | ObjectId -> Contact | |
contacts | ObjectId[] -> Contact | default [] |
stack | object[] | default [] |
stack.bot | ObjectId -> manualChatbot | required |
stack.version | number | default 0 |
stack.nodeKey | string | |
stack.vars | any | default {} |
stack.visited | string[] | default [] |
stack.enteredAt | date | default now |
routedFrom | object[] | default [] |
routedFrom.bot | ObjectId -> manualChatbot | required |
routedFrom.version | number | default 0 |
routedFrom.nodeKey | string | |
routedFrom.vars | any | default {} |
routedFrom.visited | string[] | default [] |
routedFrom.enteredAt | date | default now |
status | string | default routing · one of routing, running, waiting, handover, ended, stopped |
waitingFor | object | default null |
waitingFor.kind | string | one of node-option, tie-choice, switch-confirm |
waitingFor.nodeKey | string | |
waitingFor.options | mixed[] | default [] |
waitingFor.askedAt | date | default now |
waitingFor.retries | number | default 0 |
consumedChoiceKeys | string[] | default [] |
handover.status | string | default pending · one of pending, done |
handover.at | date | |
handover.by | ObjectId -> Member | |
handover.reason | string | |
handover.dueAt | date | default null |
turnCount | number | default 0 |
switchCount | number | default 0 |
pendingSwitch.bot | ObjectId -> manualChatbot | |
pendingSwitch.score | number | default 0 |
switchCooldownUntilTurn | number | default 0 |
routing.via | string | |
routing.reason | string | |
routing.scores | any | default [] |
routing.decidedAt | date | |
handoverReason | string | |
chatLimitNotifiedAt | date | default null |
isCurrent | boolean | default true |
counted | boolean | default true |
meterMode | string | default null · one of unique-contact-monthly, session-window, null |
periodKey | string | default null |
expiresAt | date | default null |
lastContactActivityAt | date | default null |
lastMemberActivityAt | date | default null |
closedAt | date | default null |
closeReason | string | default null · one of session-duration, contact-idle, member-idle, new-period, manual, null |
startedAt | date | default now |
lastActivityAt | date | default now |
_id | ObjectId | |
createdAt | date | set once |
updatedAt | date |