Publish a workflow
POST /workflows/{uuid}/actions/publish
/workflows/{uuid}/actions/publishPublishes the DRAFT of a workflow as its new version, provided nobody changed it since expected_draft_version and it passes the review (the same one get_workflow_validation gives), and answers the workflow as get_workflow reads it. There is no confirmation step: the first call publishes.
When to use: When the draft is ready (publishable true in validation or get_workflow_validation) and the user wants the workflow to start working, or to put the changes of the draft (unpublished_changes true) into the running version.
When not to use: To save changes without running them use update_workflow. To start it again after pause_workflow use resume_workflow, and to reopen its entries set_workflow_entry_state: publishing does not lift either. Classic automations of an audience are switched on with automation_activate.
Side effects: The first publish opens the entries of the workflow: from then on every new event of its triggers starts an execution that can send emails and SMS, create or change records, call webhooks and use AI credits, on behalf of its responsible. Nothing that happened before publishing enters. Publishing again replaces the published version only for the executions that start afterwards: those already inside go on, to the end, with the version they entered with; a trigger whose entries are paused stays paused if the new version keeps it (same uuid). Each «Send marketing email» or «Send SMS» step gets its own campaign of the account, created in the same publish. The first publish takes one automation of the plan limit (active classic automations plus published workflows that are not paused); publishing again does not. Publishing increments draft_version: to publish again later, send the one in this answer (or the last one you read) as expected_draft_version.
Permissions: Requires the automations.manage capability. The account must also have a plan with CRM and room in its plan limit of automations for a first publish.
Value for the X-Auth-Token header parameter.
In: header
Path Parameters
UUID of the workflow. Get it from list_workflows or from the answer of create_workflow.
uuidThe new Workflow resource
TypeScript Definitions
Use the request body type in TypeScript.
Workflows of the new automation engine in the public API (F7, task B4; writes since the plan «flujos en la API pública», T7 and T8). It
reads them (list_workflows, get_workflow), creates them and saves their draft (create_workflow, update_workflow) and runs
their lifecycle (publish_workflow, pause_workflow, resume_workflow, set_workflow_entry_state, delete_workflow), so that an
external client or an AI, through the public MCP, can build, publish and run a workflow end to end; the review of the draft is
{@see WorkflowValidationResource}. Each provider or processor checks its capability before the use case
({@see \App\Application\Automation\ApiWorkflowAccess}: automations.read to read, automations.work to create and save,
automations.manage for the lifecycle, as in the internal API), because API Platform evaluates security after the provider; the
rules, the visibility, CRM in the plan, the plan limit of automations and the audit (origin api) are those of the CoreBundle use
cases the internal API and Maia run (Service\App\Automation\Workflows).
The list gives the summary (with the execution counts); get_workflow the whole workflow with its draft (definition, the format 3
document as stored, in camelCase like the internal API: it is a declarative document, not API fields), the triggers of the published
version, the versions and the responsible. Creating and saving answer the same workflow plus validation (the review of the saved
draft) and neither publishes nor starts anything. Publishing has no confirmation step (decision of Sergio: an external API does not
treat an AI differently): its side effects are explained in its description, as in automation_activate. The lifecycle operations
answer the workflow as get_workflow reads it, and delete_workflow nothing (204). A workflow that the account does not have is 404
workflow_not_found.
Response Body
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
curl -X POST "https://api.easymailing.com/workflows/3f6c2a1e-8b4d-4c7a-9e10-5d2b7a9c4e61/actions/publish" \ -H "X-Auth-Token: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "expected_draft_version": 1 }'{ "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f", "title": "string", "status": "draft", "published_revision": 0, "unpublished_changes": true, "trigger_catalog_ids": [ "string" ], "entries_open": true, "paused_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "updated_by": "deea00dc-b6b6-4412-a483-26ac61e1f6fe", "draft_version": 1, "definition": {}, "triggers": [ { "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f", "entry_state": "open", "published_since_revision": 1 } ], "versions": [ { "revision": 1, "published_at": "2019-08-24T14:15:22Z", "published_by": "9ac9eee7-2153-423d-b22d-04e12679154a", "node_count": 0 } ], "resuming": true, "responsible": { "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f", "name": "string", "email": "string", "can_act": true }}