Docs / Workflows / Actions / Knowledge actions
Knowledge actions
Create a knowledge document or save a version of an existing one. Both actions write real document content from workflow data.
Create knowledge
Each successful run creates a separate document with an initial version on its main branch. titleTemplate names the document and markdownTemplate supplies its body. Both can use incoming event properties, and both must render text.
{
"titleTemplate": "Report for {{ properties.period }}",
"markdownTemplate": "{{ properties.report }}"
}A reporting workflow can pass its prepared Markdown to this action. The returned document ID and link identify the saved report.
Update knowledge
knowledgeUuidTemplate identifies an existing document. The job account needs permission to edit it. An optional titleTemplate also changes its title.
- branchMode
- main writes the published document branch. existingByName targets the branch named by branchNameTemplate. newUnique creates a separate branch from the current main version, using branchNamePrefixTemplate as its name prefix.
- contentMode
- replace saves markdownTemplate as the complete body. patch applies ordered oldText and newText edits to the current Markdown. Each oldText must match exactly once when that edit runs.
A separate branch keeps a proposed revision away from main. Saving it does not merge that revision into main.
An exact text change
{
"contentMode": "patch",
"patchEdits": [
{
"oldText": "Replies are sent within two days.",
"newText": "Replies are sent within one day."
}
]
}This example changes one policy sentence. If the old sentence is absent or repeated, the update fails instead of choosing a match.
Saved documents and versions
Both actions return knowledgeUuid, title, branchId, branchName, versionId, url and contentMode. Creation also returns createdAt. Updates include parentVersionId so the saved change can be related to its previous version.
An output event is optional when saving the document is the final result. When another job needs the ID, link or version, include that value in the output event.
Test effects
Tests create or change documents only when the Write permission is on. Otherwise the job logs a dry run and saves nothing, and values that only a save creates, such as a new document or version ID, are empty in its output event. A test with Write on that targets main changes the content later workflow runs read.