Workflows enable you to build end-to-end payment and commerce automation flows without writing any code. Primer gives you all the building blocks to create and manage your workflows based on your own business logic and requirements.

A workflow can leverage multiple Primer native and third-party apps to fulfill a use case. Each app offers a set of triggers and/or actions, enabling you to seamlessly automate and orchestrate the services that you need.

You can also connect workflows to other Primer products, such as Payments, to manage your entire payment stack in a unified way.

Workflow example

Create a workflow

Head to the Workflows section of the Dashboard to create your first workflow.

Start from a template

When creating a new workflow, you can browse all available templates that Primer has made available for a wide array of use cases for Payment Orchestration, Operational Efficiency, streamlining Shipping & Returns, and Customer Loyalty.

A template, same as a workflow, consists of a Trigger and multiple blocks (Utilities, or Actions with Inputs already set up). Each template covers a very specific use case but you can always tailor the workflow according to your requirements once you have added it to your account.

Templates list

Start with a blank workflow

If you do not want to use an existing template but start from scratch, you can also build a workflow on your own by choosing an app's trigger.

Select a Trigger

Creating a workflow from scratch always starts with the selection of an app and one of its Triggers.

List of apps and triggers

Choosing this Trigger is critical: your workflow will start executing every time an app emits an event matching that Trigger.

For instance, you can start a workflow when:

  • a shipment status is updated via Shippo
  • a support ticket is created through Freshdesk
  • a review is submitted on TrustPilot
  • a payment status is updated via the Payments app

Create workflow

In our example, we want to run our workflow each time a payment is created. The "Payment created" Trigger from the Payments App is perfect for this.

Once the Trigger has been selected, your workflow will be in draft mode. This workflow will not be live until you publish it.

The Trigger will produce a set of output values that you can use in the next workflow block to build upon.

With only a Trigger on the canvas, the workflow is not actively doing anything just yet. Now we can start adding some Actions.

Add Actions

Actions can be added to a workflow to perform tasks, such as:

  • sending a message to Slack
  • creating a task on Asana
  • authorizing a Payment using the Payments App with a payment processor

Add an action after a trigger, or after any block in the workflow. You can add more than one action to build flows with multiple blocks. Click on the action that you want to use and drag it onto the canvas, you will see placeholders where you can drop an action.

In the below example, we want to send a Slack message every time an order is created. So we need to drag the “Send message” Action right after the “Order created“ Trigger:

Drag and drop

Each action has to be configured with a set of input values. These values are critical for the action to successfully complete its task. For instance:

  • “Send a message to Slack“ needs to know what message to send, and to which Slack channel
  • “Create a task on Asana” needs to know under which project to create the task, as well as its title and description.
  • “Authorize a payment” needs to know which payment to authorize, and which processor to use

Add action

These input values can come from different places:

  • From a Trigger: e.g. the ”Authorize payment” Action can use the payment ID from the “Payment created” Trigger
  • From a previous Action: e.g. the ”Send a message to Slack” Action can use the task URL provided by the “Create a task on Asana” task
  • Set up manually: e.g. you can specify the slack channel for the ”Send a message to Slack” Action

When you add an action you will see the required inputs to complete the set-up in the right-hand drawer. In our case we need to:

  • map the “Payment ID” output of the trigger to the “Payment ID” input
  • select which Processor to use to authorize the payment

Action input

Actions are automatically executed when the previous action or trigger is successfully completed. Similarly to Triggers, an action produces output values that are available downstream. This enables you to chain multiple actions together, each being able to make use of outputs of previous blocks.

If you have connected the same app more than once (for example to test, or because of different credentials for different localities), then you also get to assign the specific instance when configuring the block. You won't be able to publish without an account assigned to a block.

Publish your workflow

Before you publish your workflow, we validate that all blocks are properly configured. Any incomplete blocks are highlighted so that you can apply the necessary fixes. Learn more about validation.

Workflow validation

Once all blocks are correctly configured, the "Publish" button becomes enabled and you can proceed with publishing your workflow.

Publish workflow

If everything is in order... congratulations, you have just created and published your first workflow 🎉

From now on, your workflow will be executed whenever an app emits an event matching that trigger. In the case of this workflow, the payment will be authorized every time a payment is created.

If anything doesn't work as intended, check our monitor workflows guide to learn how to troubleshoot your workflows.

On the Workflows overview page you can see all your published workflows, as well as draft and archived workflows.

Workflows overview

Once published, you can still edit your workflow. The changes will be saved as a draft first, but you can always promote your draft by publishing again.

You also have the option to archive a workflow to prevent any new executions. Workflows that have never been published can even be deleted, as no runs are associated with them.

Use Utilities

The workflow we just created is very simple as it runs linearly from left to right.

Utilities help you create more complex workflows, like using the (Conditions)[../conditions] or (Split)[../split] Utility to branch a workflow into multiple routes.

Conditions exist on two levels: either on the Trigger itself ("Trigger Conditions") or as a Utility within your workflow route.

Trigger Conditions

Trigger Conditions enable you to set conditions for when to actually start a workflow. For example executing a “Payment created” Trigger only for Ecommerce payments, or split payment workflows by payment method, or have different workflows depending on specific shipping updates.

Trigger Condition

Workflow Conditions

Conditions within the workflow allow you to create multiple routes. For example to run a different set of actions depending on the country of the payment:

Multi conditions

Only one route is executed at a time. If multiple routes have their conditions met, only the top-most route will be executed. Be mindful that this only applies to conditions within the workflow.

Learn more about Utilities or learn about recommendations for granular flows in our best practices guide.

Start automating

You are now able to supercharge your payment and commerce stack with the power of Workflows.

To build more powerful workflows, we encourage you to: