Skip to content

Step: End Session

  • Key: end-session
  • Category: Workflow Control
  • Description: End the active conversation session from a Flow.

Inputs

  • reason (text, optional): Reason stored on the ended session. Defaults to flow_completed.

Outputs

  • success (boolean): Whether an active session was ended.
  • message (string): Success or no-session message when available.
  • sessionId (string): Ended session ID when a session was found.
  • endReason (string): Reason stored on the session.
  • endedAt (date): Time the session was ended.
  • conversationId (string): Conversation ID used to locate the active session.
  • error (string): Error message when the step fails.

Notes

  • This step needs conversationId in the flow context. Peer-triggered and message-tied executions provide it.
  • If no active conversation/session exists, the step returns success: false instead of producing a final message.
  • A new session can start automatically when the user sends a later message, depending on the channel and session configuration.
  • Combine with a final step when you also need to return a visible closing response.

Example Use Case

  1. Flow completes a support handoff or booking workflow.
  2. end-session runs with reason = "task_finished".
  3. A final step returns the closing response to the user.

Built with VitePress