TABLE OF CONTENTS
The Workflows page allows you to create, configure, and manage workflows.
The CafeX workflow engine provides a powerful toolset for automating complex processes within applications built in CafeX App Studio. This article explores the primary components of a workflow, such as triggers, connectors, actions, and responses, as well as explains how to configure and execute workflows within the App Studio.
Prerequisites
To invoke and consume workflows in the CafeX app studio, ensure the following prerequisites are met:
- Your CafeX tenant has the workflow feature enabled. To activate this feature, please contact your sales representation at support@cafex.com.
- You have an application created.
Workflow Components Overview
To build a workflow effectively, let’s first introduce its main components: Workflow Triggers, Connectors, Actions, and Workflow Responses.
Workflow Triggers
A trigger is the starting point of any workflow. These are the conditions or events that initiate workflows, allowing you to automate actions when specific inputs or conditions are met.
App Studio offers various triggers for both internal and external activation, for example Workflow Invoked and Catch a Webhook triggers. If your workflow is being started by a user interaction from an App Studio App, it is advisable to use the Workflow Invoked trigger. If your workflow needs to be triggered by an external source, such as another application or service, you can use the Catch a Webhook trigger.
Workflow Actions
After a trigger fires, the workflow moves through a sequence of actions, each representing a specific step in the process. Actions can be customized to perform different tasks based on your workflow’s objectives. The App Studio provides various types of actions which fall under two main categories:
- Core: Actions that manage workflow logic. For example, the Branch action action allows workflows to follow different paths based on conditional outcomes; the Loop action allows looping over a list of items; the Code action supports Node.js and TypeScript code with npm packages. Other useful actions include HTTP, Delay, Crypto, and many more.
- App Actions: Actions that invoke integrations with external applications. These integrations usually either perform tasks and/or retrieve sets of data. There are hundreds of applications to choose from, ranging from integration with AWS services to simple tasks like CSV processing.
Workflow Connectors
Connectors enhance workflow functionality by linking CafeX App Studio to third-party applications or internal tools. A connector is a wrapper that contains both triggers and actions for a given application or service. It acts as a bridge between different systems, enabling them to communicate and share data seamlessly. Most connectors require configuration, where users must provide account details to establish access to the integration.
For a list of triggers available as part of the CafeX Connector, see the Workflow Triggers article.
For a list of actions made available as part of the CafeX Connector, see the Workflow Actions article.
Workflow Responses
Responses provide feedback from the workflow back to the original source, whether it’s an external application or the App Studio. This feedback can include success messages, error notifications, or any relevant data generated during the workflow execution.
Building a Workflow
You can access the Workflows editor through the Workflows menu item () within the App Studio. Selecting this menu item displays a list of all Workflows for the current App and provide the option to create a new one using the Add new Workflow button.
Adding a New Workflow
In this particular example, we’ll create a simple workflow with a trigger and an action.
To create a workflow:
- Navigate to the Workflows editor and click Add new Workflow.
- Enter a name for your workflow, then click Add.
- The built-in workflow editor page opens, allowing you to design and configure your workflow. In this editor, you define the trigger for your workflow, specify the steps it should execute, and determine the results that need to be recorded. The details on how to configure the workflow follow.
- Next, add a trigger, that is, define when the workflow will execute. There are many possible triggers provided by different integrations. For details, see Adding a Workflow Invoked Trigger, Adding a Webhook Trigger sections below.
- Add a response action. For details, see Adding a Response Action section.
- Save and publish the workflow.
As you build the workflow, it automatically saves as a draft. Once all configurations are complete, click Publish in the top-right corner of the editor to activate the workflow. The workflow will now be available for use within the App Studio.
Adding a Workflow Invoked Trigger
This section explains how you can set up the Workflow Invoked trigger.
To configure the Workflow Invoked trigger:
- Click on Select Trigger.
- Find the Workflow Invoked trigger by typing “invoked” in the search field on the right-hand side.
- Next, configure the fields that will be passed into the workflow when it is invoked. These fields define the input schema. There are two ways to do this:
- Basic Option: Click Add Item in the Input Data section of the configuration and fill out the details.
- Advanced Option: Define the input fields manually in JSON.
You can specify multiple fields to describe the input to your workflow. These fields will be made available as inputs that users in CafeX App Studio can configure based on their actions within the application.
- Once the input schema is defined, click Load Data to generate sample data, which you can reference in the workflow actions later.
Adding a Webhook Trigger
This section explains how you can set up the Catch a Webhook trigger, allowing external systems to invoke workflows by sending data to a generated webhook URL. This is ideal for integrating external services or apps with your App Studio workflows.
To configure the Catch a Webhook trigger:
- Click on Select Trigger.
- Type “catch” in the search Select Trigger search field on the right-hand side to locate the Catch Webhook trigger.
- Select Catch Webhook and configure the authentication method:
- For Basic Auth, specify Username and Password.
- For Header Auth, specify Header Name and Header Value.
After setting the trigger, you can test the webhook setup:
- Click the Test Trigger button.
- Use an API testing tool to send a test request to the generated webhook URL. Once the test completes, you’ll receive sample data, which you can reference in the workflow’s actions.
Note: If a response is expected from the webhook, append /sync to the webhook URL. In this case, be sure to add an HTTP step with a Return Response action at the end of the workflow to send the reply.
Adding a Response Action
Workflows invoked from the App Studio can also have an output schema, which defines the data produced by the workflow and made available to the App Studio. The schema that is available inside the App Studio is determined automatically based on the configuration of a Return response action. To add this action:
- Click the plus (+) icon to create a new action.
- Search for Return Response in the right-hand panel.
- For Action, select Return Response in the drop-down.
- Select a Connection or add a new one.
- Configure the Response to be sent back to the invoking app. The response should be a structured JSON message that can either be typed directly into the Response field or constructed using data from previous steps in the workflow. For example, to return a simple message like "Hello world", you would add a response like this:
You can also insert dynamic values from the trigger or previous actions by selecting the value from the popup when clicking inside the field.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article