Rolling out beta functionality with Flags

What is beta rollout?

Beta functionality are typically released to select customers for early access. With Schematic, you can not only roll beta functionality out using Flags, but also subsequently entitle them into Plans you already offer your customers with no additional code changes.

Setting up a Flag

Flags are the primary building block in Schematic, and they allow you to turn features on or off without modifying application code.

To set up a Flag, do the following:

  1. Navigate to the Flags tab and click “Create”
  2. Choose a Flag name that will be visible to all users, and a Flag key, which you’ll use in your application to instrument the Flag
  3. Add the Flag to your application code using our check_flag endpoint (Follow the instructions here)

Defining a beta segment

Typically a beta group is a set of your customers that have opted into new functionality. To create one in Schematic, you will need to use Company traits.

Traits can be added to Company profiles using the Company upsert API.

Here’s an example of adding a beta trait to a company:

1from schematic.client import Schematic
2
3client = Schematic(
4 api_key = "your-api-key"
5)
6
7response = client.companies.upsert_company(
8 keys={
9 "your-company-key" : "value"
10 },
11 traits={
12 "beta" : true
13 }
14)

Targeting your beta segment with Flag Rules

Once you’ve segmented companies within Schematic, you can set up a rule to target them.

To set up a Flag Rule, do the following:

  1. Navigate to your Flag
  2. Click “Add new rule”
  3. Target Companies with the trait corresponding to the beta segment
You can also individually target Companies or Users with Flag Rules

Adding a beta Flag to your application

Adding a beta flag from Schematic in your application is relatively straightforward. The following code performs a Flag check for a Flag with a key beta-flag. Schematic only requires a Company key and a Flag key to evaluate Flag conditions, and this is possible because context associated with companies is stored within Schematic (e.g. the trait we set up above). When a check_flag request is performed, Schematic will refer to the data already stored on the Company or User profile to evaluate Flag Rules.

1from schematic import Schematic
2
3client = Schematic(
4 api_key = "your-api-key"
5)
6
7company = {
8 "your-company-key" : "value"
9}
10
11if client.features.check_flag(flag_key='beta-flag', company=company):
12 do something
13else:
14 do something else

Turning Flags into Plan Entitlements

Once you are ready to fully release a beta feature, you can easily convert it within Schematic so that you can add it to a plan to offer it more widely.

To convert a Flag into a Plan Entitlement, do the following:

  1. In the Flag view, click “Convert to feature”
  2. Choose the feature type (Boolean, Event-based, Trait-based) and finish the wizard
To learn more about Event-based and Trait-based Features, click here
  1. Click “Add plan entitlement” and add to an existing Plan

You can optionally remove the Rule in the Flag view that is targeting your beta segment to ensure only those that should have access to the new functionality receive that access.