What developers can do

People who connect other systems to FlowAssembly.

Move, copy and retire a project

Export a project as one file and import it on another machine or instance, copy it as a new project under another name, and archive it when it is no longer used: it starts no new cases, and every case keeps its history.

  1. fa export <project> writes the project’s files, without its Git history or builder runs, to one .faproject file.

  2. fa import <file> <folder> makes it a project of its own, with its own Git repository; --name gives it another name.

  3. fa clone <project> <folder> --name <new-name> copies a project as a new one.

  4. fa archive <project> --environment <env> stops the project starting cases; cases under way carry on. Deploying it again brings it back. Build, Projects shows it as archived.

Example. The agent recruitment project is cloned as agents-abuja for a new region, and the old one archived when it closes.

Start and move cases from another system

A partner system sends a message the project declares. It reaches the case waiting for it or, if a process starts on that message, starts a new case with the message’s data.

  1. Declare the message in project.yaml with the fields it may set and the field that matches it to a case (correlateBy).

  2. In the builder, make the process’s start event a message start event for it. Try it with “Send the message” in a run.

  3. Give the partner system’s role the runtime.message permission, and raise the instance’s project role ceiling to allow it.

  4. The system sends POST /api/v0/projects//messages/ with {"payload": {...}}. A 201 means a case started; a 200 means a waiting case received it; a 202 means it came early and is kept for its case.

Example. In the partner intake project, a partner portal sends application_received to start a review, then documents_received for the same application reference.

Start and move cases from another system

Build on the web API from its OpenAPI description

Every operation of the web API is described in OpenAPI 3.1: what it takes, what it answers and who may call it. Generate a client from it, or read the reference in the guides. Every answer FlowAssembly’s own tests receive is checked against it, so it matches the API.

  1. In the guides (Help, or /docs), open Web API reference, and download openapi.yaml.

  2. Generate a client with your usual OpenAPI tool, or call the API directly.

  3. Give the system an account of its own with only the roles it needs, and sign in as Using the web API says.

Example. Example Microfinance Bank’s loan portal sends each application as a message to the agent loans project, from a client generated from the description.

Take a project from a merge to production through a pipeline

A project repository’s pipeline checks every pull request, packages and signs each merge, deploys it to a development database with smoke tests, and sends the same bundle to production once an approver signs for it.

  1. Copy FlowAssembly’s templates/github/flowassembly-pipeline.yml and templates/github/scripts into the project repository.

  2. Make the pipeline key with fa keys generate, store the private half as the FA_CI_SIGNING_KEY secret and commit the public half with the trust files.

  3. Give the repository read access to the flowassembly-pipeline image.

  4. Approvers make their key once with scripts/approver-key.sh, and approve a merged release with scripts/approve.sh <run id>.

  5. To change production’s trust file (keys added, replaced or revoked), an approver it already trusts signs it with scripts/approve-trust.sh; the push applies it.

Example. Dave-Aganran/flowassembly-agent-recruitment and Dave-Aganran/flowassembly-loans each hold a reference application and run this pipeline to the same production.

Add a kind of connection of your own

When no built-in connection reaches a system, write a connector type in Python with the connector SDK, test it with the test kit, and install it as a package. Projects use it like any connection; FlowAssembly checks and renames its fields, retries it and reports each call. An instance runs it only once switched on in its settings.

  1. Write a ConnectorType subclass (flowassembly.connectors.sdk), naming the settings that hold case fields and how a call is made.

  2. Test it with flowassembly.connectors.testing.

  3. Declare it as a flowassembly.connector_types entry point, review it, and install the package with FlowAssembly.

  4. Switch it on in the instance settings: connectorTypes: [ledger].

  5. In a project, write type: ledger in connectors/.yaml.

Example. examples/connector-type-file-drop adds one CSV row per call to a folder an older core system collects from.

Let another system send messages as signed webhooks

A partner system can post a message to FlowAssembly without signing in, signed with a key the instance keeps. FlowAssembly takes the message’s fields from wherever the system puts them, and a repeated post never acts twice.

  1. Give the message a webhook key in the builder (Project, Messages), or in project.yaml: webhook: {secretRef: partner-webhook}.

  2. Prefer Standard Webhooks where the system offers it: its posts carry their time, so an old one is refused. If the system signs its own way, say how: signature: {header: X-Signature, prefix: “sha256=”}. If its fields are not at the top of its JSON, say where each is: fields: {application_ref: /data/reference}.

  3. Ask the operator to put the key in the instance’s secrets under that name. Until then the address answers as if it did not exist.

  4. The system posts to /api/v0/projects//webhooks/. A 201 means a case started, a 200 that a waiting case received it or that the post repeats an earlier one, a 202 that it came early and is kept for its case, and a 409 that no case was waiting and the message is not kept.

Example. In the partner intake project, the partner portal posts application_received to start a review, then documents_received, signed its own way, with the reference at /application/reference.

Let another system send messages as signed webhooks

Start and move cases from messages on a RabbitMQ queue

A message the project declares can be taken from a RabbitMQ queue another system publishes to. It reaches the case waiting for it or starts one, is acknowledged only once the case has it, and a repeat of it never acts twice.

  1. Add a RabbitMQ connection to the project, naming the secret with the account’s password; the operator binds the broker for each environment.

  2. In the builder, under Project, Messages, choose that connection for the message and name the queue.

  3. If the message’s fields are not at the top of its JSON, say where each is in project.yaml: queue: {fields: {loan_ref: /data/reference}}.

  4. Give the queue a dead-letter exchange, so messages FlowAssembly rejects are kept for someone to look at.

Example. The core banking system publishes payment_posted to flowassembly.payments; the loan case waiting for that loan reference moves on.

Start and move cases from messages on a RabbitMQ queue

Drive cases from another application

A JSON API under /api/v0 does everything the web application does, with the same sign-in, permissions, form rules and audit.

  1. Sign in with POST /api/v0/session and keep the session cookie and CSRF token.

  2. Start a case with POST /api/v0/projects//cases.

  3. Read your tasks, and submit one with POST /api/v0/cases//tasks/.

Example. tests/reference_flow.py takes a recruitment case from registration to an agent code over HTTP.

Write a plugin

A Python package adds connector types, form fields with their own checks, pages with their own API, and settings, through one class declared as a flowassembly.plugins entry point.

  1. Subclass flowassembly.plugins.Plugin, and declare it under the flowassembly.plugins entry point.

  2. Give a form field a browser module exporting field(fa), and a check the server applies to every value.

  3. Give a page a browser module exporting mount(element, fa), and answer its calls in api.

  4. Install it where the builder runs to offer its fields in the form editor and try them in a run.

Example. The example plugin in tests/plugins has a signature field, a ledger note connector type, and a page of today’s signatures.

Write a plugin

Protect a project repository on GitHub

One script makes a project repository’s main change only through pull requests whose checks pass, stops force pushes and deleting it, and lets the production jobs run only from main, beside FlowAssembly’s own signed approval.

  1. From a clone of the project repository, run scripts/protect-repository.sh (needs gh, as an administrator; a private repository needs GitHub Pro).

  2. When a second person can review, run REQUIRED_REVIEWS=1 scripts/protect-repository.sh.

Example. Dave-Aganran/flowassembly-agent-recruitment and Dave-Aganran/flowassembly-loans are protected this way.