1. Core Substitution Context
  2. Context

Core Substitution Context

Context

Provides the stub context from the core substitution context. Useful for context-aware stub creation and reusable actions across template flows.

A stub context identifies the flow within a template in which a stub is running. Referencing the current context allows actions to adapt to different flows without hardcoding a specific context name.

Common contexts include:

  • default — the main process stub, such as a customer's onboarding conversation.
  • _create — the entry or setup flow that receives an initial channel message and creates a default stub.
  • _manage — a management-level workflow across multiple stubs.
  • _setup — setup work performed when the template is installed or initialized.

For more information, see Contexts.

Usage

Use the substitution ~~stub.program.context in your action definitions to dynamically insert the context of the current stub. This is particularly useful for tasks that create stubs or perform context-specific processing.

Example

Action definition:

loading...

Substituted definition:

loading...

In this example, the ~~stub.program.context substitution is replaced with the current stub's context (_create). The new stub is therefore created in the _create context without requiring the context name to be hardcoded in the action definition.

This substitution is useful when an action must create another stub in the same context as the stub running the action. Because the context is resolved at runtime, the action remains flexible and can be reused in different template contexts without being manually updated.