Export and unlink
Export turns a Sommatic AI workflow or knowledge resource into a repository file with tokens, ready for a pull request. Unlink stops syncing one resource in one installation without touching the repository.
Sommatic AI never writes to your repository. When a change starts in the studio, or when you bring an existing workflow under Git for the first time, you export it and commit the file yourself. When one installation must stop following Git for a while, you unlink the resource there.
Export a resource
In the studio or the knowledge resource editor, open the menu … → Export for Git…. You get three things:
- the file, in the repository format:
sommaticheader, sorted keys, two-space indentation; - the manifest entry to add to
sommatic.json,{ "key", "path" }; - the environment entry to add to
resourcesin the environment file, key → id of this installation.
Through the API:
curl -s -X POST "$SOMMATIC_API/platform-infrastructure/git-sync/export" \
-H "Authorization: Bearer $SOMMATIC_TOKEN" \
-H 'Content-Type: application/json' \
-d '{ "repository_id": "<repository_id>", "resource_id": "<flow_definition_id>", "package_path": "support" }'kind (workflows or knowledge) and key are optional. When the resource is already declared in the environment
file, export reuses its key and file path. The result has text (the file), file_path, manifest_entry,
environment_entry, tokens and warnings. Export writes nothing.
How values become tokens
Export reads the environment file of the connection and replaces:
- every string equal to the value of a variable with
@@env.NAME@@, and boolean variables where the code assigns them (NAME = true); - every id declared in
resources(including the resource’s own id) with@@ref.<key>@@; - values that look like secrets (authorization headers, API keys, account keys, signatures, private keys) with
@@secret.<name>@@. If the current repository file already names the secret at that place, export reuses the name; otherwise it writes@@secret.REPLACE_ME@@and adds a warning.
Bring a new resource under Git
Apply only updates resources that already exist, so a new workflow starts in Sommatic AI:
Create it in each installation
Create the workflow (or knowledge resource) in every installation that will sync it, and note its id in each one.
Export it
Use Export for Git… in one installation and add the file to the package folder.
Register it
Add the manifest entry to sommatic.json and add "<key>": "<id>" under resources in every
environment file, each with the id of its own installation.
Open a pull request
Merge it into the branch of the first installation, then preview and apply.
Unlink a resource in one installation
The link between a file and a resource lives in the repository: the manifest lists the key, and the environment file maps the key to an id. Sometimes one installation must stop following Git for a while, for example during an incident fix made directly in the studio. Unlinking does that without a pull request:
curl -s -X POST "$SOMMATIC_API/platform-infrastructure/git-sync/link" \
-H "Authorization: Bearer $SOMMATIC_TOKEN" \
-H 'Content-Type: application/json' \
-d '{ "resource_id": "<flow_definition_id>", "linked": false }'While it is unlinked, the preview marks the item unlinked_here, apply skips it (skipped), and a preview of that
single resource returns unlinked.reason unlinked-here. Send "linked": true to resume syncing. The repository keeps
the entry until someone removes it with a pull request.
When a resource is not linked
A preview of one resource returns unlinked, with no items, when the link is missing:
unlinked.reason | Meaning | Fix |
|---|---|---|
not-declared | The resource id is not under resources in the environment file. | Add the key and id to the environment file. |
no-package | The environment file declares the key, but no sommatic.json lists it. | Add the manifest entry. |
unlinked-here | The resource was unlinked in this installation. | Relink it with "linked": true. |