Concept
Startup initialization belongs inON_START. Values set there are written into session data before the welcome response and before the entry flow runs. This is useful for counters, channel labels, selected locale, feature flags, campaign markers, and any value that should be stable for the rest of the conversation.
Keep initialization deterministic. ON_START SET is for values already available at startup, not values that require asking the user.
Minimal working example
How it works
SET assignments run before RESPOND. Assignment values are resolved against runtime session values. The flow can use the initialized variables immediately.
Common variations
Initialize project or campaign values
Use constants or channel-supplied values for campaign and entry-state variables. This example uses constants; in a real channel integration, those values are usually copied from trusted session metadata.Verification
Start a session and inspect session values after initialization. Confirmretry_count, channel_name, and preferred_language are present before the first flow response. In traces, check dsl_set events with source: on_start.
Common mistakes
Troubleshooting
If a variable renders as empty, verify the runtime path exists. For channel-specific fields, confirm the channel actually supplies the value before the session starts. If the value should come from the user, collect it withGATHER instead of startup SET.
Production readiness checklist
- Initialize only values available before the first user turn.
- Keep names consistent with later
WHEN,PASS, and template references. - Avoid writing sensitive values unless they are needed.
- Trace every startup assignment during validation.
- Reset counters intentionally when a new session starts.