1. Templates
  2. Contexts

Templates

Contexts

A context represents different viewpoints of a template.

Contexts allow separating the different high-level flows of a template.

There are built in contexts that are available by default and the ability to create custom contexts.
The built in contexts are default, template, create, manage and all.

A context always relates to the template and what you are building in Stubber.
So for example if you are building a "Sales Enquiry" process, then your template will be called "Sales Enquiry", then this means :

  • the default context will be the flow used for each "Sales Enquiry" stub, so for each "Sales Enquiry" instance
  • the create context will be the flow used to create a new "Sales Enquiry" stub
  • the manage context will be the flow used to manage all the "Sales Enquiry" stubs in aggregate, for example to close all open "Sales Enquiry" stubs
  • the template context will be the flow used when the "Sales Enquiry" template is updated, for example to notify stakeholders of the change to the "Sales Enquiry" template
  • the all context contains flow elements that are common to all contexts

Built in contexts

Default

The default context contains the definition of the actual process flow for the template.

For example if you created a new "Sales Enquiry" stub the process that each "Sales Enquiry" would follow is defined here, so in this example it might contain actions allowing the user to "collect customer details" or "send_quote".

Template

The template context contains the definition of what happens when changes to the template are made.

For example, you can define that when a new version of the "Sales Enquiry" template is published, a notification is sent out to a certain Slack channel.

Create

The create context contains the definition of how to create new stubs of this template.

For example you could use the create context to define that an email gets sent out each time a new stub of the "Sales Enquiry" template gets created.

Manage

The manage context contains the definition of the process to manage all the stubs of the template together.

For example you could use the manage context to define actions that would close all the open stubs or generate a report for all the open stubs.

All

The all context is merged into all other contexts.
If you define an action in the all context it will be available in all other contexts.

For example, you could define a notify_stakeholders action in the all context and it would be available on stubs created for any of the default, template, create and manage contexts.

NOTE

The all context is merged into all other contexts so it follows a different merging rule than the other contexts.

Custom contexts

In addition to the built in contexts, you can create custom contexts.
You could do this to define other flows that are specific to your business process.
For example, a "Sales Enquiry" template might have a weekly_check context that contains a flow for checking all the open "Sales Enquiry" stubs once a week. A common place use of custom contexts is to define an evaluation flow for testing AI based conversation templates.