/ Search

Search Epistola

Find documentation, integration guides, tour steps, blog posts and pages.

DocsIntegrationsTourBlogPage
↑↓↵esc

Attributes

Attribute definitions in a catalog, with keys, display names, allowed values, and how they select variants.

Attributes

With attributes you describe why a template variant exists. For example: a Dutch version, a version for a corporate brand, or an email layout. An attribute definition belongs to a catalog. Templates in that catalog can use it. Templates in other catalogs of the tenant can use it once their catalog declares this catalog as a dependency.

Create an attribute

You need Content Author access to a catalog you can edit.

  1. Open All catalogs in the side nav, choose the catalog, and open Attributes in the side nav.
  2. Choose New attribute.
  3. Enter a Display name, such as Brand. Epistola fills in the Attribute ID brand.
  4. Under Value constraint, choose Inline values — listed below. Enter corporate and consumer on separate lines.
  5. Choose Create attribute.
  6. Open a template’s Variants tab and give a variant a Brand value. How to do that is in Create a language or brand variant.
  7. Preview both layouts with realistic examples.

The System catalog already has language, locale, and country, each bound to a code list. Epistola supplies that catalog, so you can only read it. Use these attributes, and do not create your own with the same keys.

Attribute definitions

Each definition has:

  • Attribute ID — The key, such as brand or channel. It has 3 to 50 characters: lowercase letters, numbers, and hyphens.
  • Display name — A readable label, such as “Brand”.
  • Value constraint — Which values a variant may use:
    • Free format — any value allowed.
    • Inline values — listed below: a list you keep in the definition itself.
    • Bound to code list: the values come from a code list.

The key is the fixed identifier in API requests and in variant data. Keep it short and consistent. Use a key such as brand or channel, not a label that may change.

Bare and qualified keys

A variant names an attribute in one of two ways:

  • Qualified, as <catalog>.<key>, such as system.language. This names exactly one definition.
  • Bare, as just the key. Epistola looks for it in all catalogs of the tenant.

The same key can exist in more than one catalog. So the variant cards, the filter bar, and the Add attribute picker show the qualified key, such as Language (system.language).

If you use an attribute from another catalog, your catalog starts to depend on that catalog. The picker shows those attributes under Other catalogs (adds a dependency).

Usage

After you create a definition, give template variants key-value pairs. For example, a template might have variants with language=nl, language=en, or brand=corporate. A variant can use several attributes at once.

Attributes serve two purposes:

  1. Variant classification — Each variant gets key-value pairs. These describe what the variant is like.
  2. Automatic variant selection — If a generation request includes attribute criteria, Epistola compares them with the attributes of the variants. That way it finds the best fit.

Epistola checks each value against the definition’s value constraint. Two variants of one template cannot have the same set of attributes, because no request could tell them apart.

Choosing a variant

A request can select a variant in either of two ways, but not both at once:

  • Explicitly — Send a variantKey when you already know which variant to render.
  • By criteria — Send attributes, a list of criteria with key, value, and required. A criterion is required unless you set required to false.

A criterion without a catalogKey names an attribute in the template’s own catalog. For an attribute from another catalog, add its catalogKey. For example, the System language attribute is { "catalogKey": "system", "key": "language", "value": "nl" }.

Epistola selects the variant like this:

  1. It removes the variants that do not match every required criterion.
  2. It scores the remaining variants: 100 points for each required match and 10 points for each optional match.
  3. The variant with the highest score wins. Other attributes of a variant do not count.
  4. If two variants share the highest score, the request fails with status 409 and the problem type ambiguous-variant. The response field tiedVariants lists the variants that tie. Add an optional criterion to tell them apart, or send a variantKey.
  5. If no variant matches the required criteria, Epistola uses the template’s default variant.

In the UI

The Attributes page of a catalog shows a table with the columns ID, Catalog, Display name, Allowed values, and Created.

Each row has these buttons:

  • Edit — Change the display name or the value constraint.
  • Rename or move… — Change the key or move the attribute to another catalog. Epistola first shows a preview. It then updates the variants that use the attribute in the next release. Releases you already published keep the old key, and so do integrations that send it. Applying a move needs the Tenant Administrator role.
  • Delete — Remove the attribute.

You cannot delete an attribute while a variant uses it. You also cannot remove an allowed value that a variant still uses.

More on this topic

Epistola is open source, not free of cost. The organisations that use it fund its development, through Epistola or an Official Partner. We are steward-owned: fair prices, no profit maximisation. How Epistola is funded →