Workflows are scoped to the environment. The same
workflowId in Development and Production refers to two separate workflow records. Update definitions in Development, then sync when you are ready to publish. For more on environments, refer to Publishable assets.How workflow management works in production
Managing workflows in production is a two-phase process. You update workflow definitions in Development from your application code, then you publish those definitions to Staging and Production through CI/CD. In a real application you usually manage many workflows (for example,payout-initiated, weekly-digest, and order-shipped). The flow is the same for each one: pick a stable workflowId per workflow, run the update-first helper for every ID in your list, then sync each ID in CI/CD.
Phase 1: Update workflow definitions in Development
Store workflow definitions in your repository (steps, payload schema, and channel content). For eachworkflowId, call update first, because that is the path you use on almost every run. Create only when update returns 404 (that workflow does not exist yet in Development).
Phase 2: Publish workflows to other environments in CI/CD
When definitions in Development are correct, publish them with Sync a workflow. Run sync from your CI/CD pipeline (for example, after a merge tomain) once per workflowId so Staging and Production receive the same set of workflows. Use your Development secret key when calling sync. Pass the target environment identifier from the Novu Dashboard. Each sync copies one workflow from Development into the target environment under the same workflowId.
End-to-end sequence
- Update workflow definitions in Development for each
workflowIdyou manage as code. - Publish each workflow from Development to the target environment (Staging first, then Production, if you use both).
Prerequisites
Install the SDK for your stack and set your secret key from the Novu Dashboard:- Node.js (@novu/api)
- Python (novu-py)
Update workflow definitions in Development
This section implements phase 1: updating workflow definitions in Development. For eachworkflowId, try update first and create on 404:
- Update the workflow with that
workflowIdand its full definition. - If update returns 404, create a new workflow with the same
workflowId.
workflowId you manage as code (a constant array, a registry map, or exports from workflow modules) and loop over it in your deploy script or bootstrap job.
- Node.js
- Python
- Python
Next steps
For individual workflow operations, refer to these guides:Create a workflow
Create a workflow with the Novu API.
Update a workflow
Update a workflow with the Novu API.
Delete a workflow
Delete a workflow with the Novu API.
Retrieve a workflow
Retrieve a workflow with the Novu API.
Sync a workflow
Sync a workflow with the Novu API.