|
Node |
Set Last Agent ID |
|---|---|
|
Description |
The Set Last Agent ID node |
Execution & Payload Details:
-
Reads from:
-
msg.payload.recent_conversation.agents: array of agent objects; last element’sidis used. -
msg.payload.session.channel.channelConfig.routingPolicy.routeToLastAgent: boolean flag to enable this behavior.
-
-
Writes to:
-
msg.payload.last_agent_id: string/number ornull.
-
-
Logic:
-
If both
recent_conversationandsessionexist, androuteToLastAgent === true: -
Sets
last_agent_idto theidof the last agent inrecent_conversation.agents. -
Otherwise sets
last_agent_id = null.
-
-
Behavior:
-
On success, forwards the message with
payload.last_agent_idset. -
On error, logs and raises a node error; message is not forwarded.
-
-
Example:
-
Input:
payload.recent_conversation.agents = [{id:"A1"},{id:"A2"}],payload.session.channel.channelConfig.routingPolicy.routeToLastAgent = true -
Output:
payload.last_agent_id = "A2"
-