Creating a workflow
You can create a new workflow by running the following CLI command:workflows/ folder of your selected integration:


Defining steps
In thedefine function of a workflow, steps can be created and configured. A step can be created in one of the following ways:
- Standard steps and triggers (App Event Trigger, Request Trigger, Cron Trigger, Function, Request, Response, Conditional, Fan Out, and Integration Request) must be imported from the
@useparagon/corelibrary and configured to include the parameters that are required to run the step. - Integration-specific Actions or Triggers are available in the
integrationparameter passed to thedefinefunction.
@useparagon/core package: @useparagon/core Glossary.
Referencing step outputs
Steps can be declared and configured in thedefine() function in any order. You will define an explicit flow/ordering for the steps using orchestration functions: see Orchestrating steps.
To reference step output in another step, simply access the .output property of a step or trigger:
{{1.output.contact.email}} syntax of the Workflow Editor. For more advanced transformations on outputs, use a Function step.
Referencing User Settings and Environment Secrets
To reference User Settings or Environment Secrets as inputs, use thecontext parameter of the define() function.
The .getEnvironmentSecret function will use the Environment Secret value stored at a specified key.
.getInput function will get the value of a User Setting. You can reference integration-level User Settings by importing from the integration’s inputs.ts file or workflow-level User Settings with this.inputs.
Referencing User Metadata or IDs
To reference User Metadata or your Connected User ID, use theconnectUser parameter of the define() function.
persona.meta.ts file at the root of your Paragraph src/ folder. You can export an example metadata object from that file to expose available fields.
Conditional logic
Some steps will require you to defineConditionInput parameters, such as the Conditional Step or Stop Condition for Request Step Pagination.
When you need to define a condition, start by importing the Operators from @useparagon/core:
Orchestrating steps
After defining or importing steps, the workflow requires an orchestration that describes how the steps are connected in the control flow. The basic way to orchestrate step is to use the.next() function, available for every step. For example:
Conditional branches
Conditional steps have additional functions,.whenTrue() and .whenFalse() for creating execution branches when a condition is True or False.
.whenTrue or .whenFalse functions. If unspecified, the respective True/False branch will be empty.
Fan out branches
Fan Out steps have an additional function,.branch, for creating a branch of execution that runs in parallel over an array of data.
Note that the branch function is not chainable.
Reusing steps
You can reuse steps or configuration by creating a shared top-level directory in your projectsrc/ folder (the name can be anything except integrations).
For example, you can create a common/ folder within src/:
execution data, you can import the static Execution class from the @useparagon/workflow library: