/ Search

Search Epistola

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

DocsIntegrationsTourBlogPage
↑↓↵esc

Connected Systems

Let another system generate documents from templates you released.

Connected systems

Most teams generate real documents from another system. That can be Valtimo, a case system, a workflow engine, or a custom application. Epistola creates the document. The connected system supplies the data and requests the document.

How the connection works

The connection works in five steps:

  1. A process or a user in the connected system starts generating a document.
  2. The system names the catalog and the template, as its configuration says. It can also name an environment or a version range. Where needed, it selects a variant.
  3. It sends JSON data that matches the template’s data contract. It may send a variant or attributes instead of a variant.
  4. Epistola picks the catalog release to render, evaluates the expressions, and generates the document.
  5. The connected system stores, shows, or sends the result. It handles failures the way the process prescribes.

Which release Epistola renders depends on what the request names:

  • No environment and no version range: the highest release (the highest version number) of the catalog.
  • A version range, such as 1.4.0 or ^1.4.0: the highest release that matches it.
  • An environment: what that environment serves. An environment can serve several releases side by side. Without a version range Epistola renders the highest of them; with a version range, the highest one that matches.
  • A test environment that follows a draft: if the request names no version range, Epistola renders that draft. Its documents carry a preview watermark. An environment marked as production serves only releases.

Environments are optional. They are useful when you want to decide in Epistola which releases a connected system gets, for example a test system and a production system. The whole route from template to document is explained in From template to document.

The connection uses an API key of its own, with only the permissions it needs. Set up access separately from the template content. How that works is in Access & Permissions.

Prepare the Epistola side

Check that:

  • The catalog has a release that contains the template.
  • If the connection uses an environment, a release of the catalog is deployed to it.
  • The owner of the connection knows which release was approved.
  • The connected system knows which catalog, template, and variant to use, and what to do with the output.
  • The variant rules are written down, if the template has more than one variant.
  • The integration team knows the template’s data contract and required fields.

Prepare the connected system

The connected system should be able to:

  • Identify itself with its own API key.
  • Send data in the shape the template’s data contract expects.
  • Select a variant itself, or send the attributes Epistola uses to select one automatically.
  • Store the document together with a correlation id or an id from its own process.
  • Tell a successful response apart from failures. A failure can be a refused key, a template or release that Epistola cannot find, or a document that fails to generate.

An example: in GZAC, the Epistola plugin is set up with the Epistola address, the tenant, the API key, and a default environment. A process step with the Generate document action maps case data to a template. When the document is ready, the process can store the PDF with the case. A custom application can run the same steps directly against the Epistola API.

Plan failure handling

Before you go live, write down what happens on success and on failure. Decide what happens when:

  • required data is missing, or does not match the data contract
  • Epistola cannot find a variant, or finds more than one that fits
  • the environment serves no release of the catalog
  • Epistola rejects the API key
  • generating the document fails

What fits depends on the process. It can be a retry, a user task to correct data, or an alert to operations. Make sure someone can review failed documents together with the original request.

What to give the implementation team

Give developers:

  • the catalog, the template, and the release or environment to use
  • the variant rules
  • the required fields
  • example payloads
  • what should happen to the output
  • how failures and review should work

The technical details are in the Generation API reference.

User responsibility

Users and process owners check that the document is correct for real cases. Developers check the technical side: authentication, payload mapping, template selection, what happens to the output, and retries.

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 →