Trigger Workflow with Appsmith App
Connecting your Appsmith workflow to an Appsmith app, allows you to trigger actions and automate processes from inside the Appsmith environment. This page shows how to connect Appsmith workflow with Appsmith app.
Prerequisites
Before starting, make sure you have:
- A self-hosted Appsmith instance with a business subscription. Refer to the Appsmith installation guides for detailed instructions if you need to set up your instance. You can also get a trial license by signing up on customer.appsmith.com.
- Basic familiarity with Appsmith operations. If you're new to Appsmith, follow the Getting Started Tutorial to learn the basics.
- Basic knowledge of creating a basic workflow in Appsmith. If you're new to Workflows, follow the Tutorial - Create Basic Workflow to learn the workflow basics.
- PostgreSQL must be configured and accessible. Appsmith workflows require PostgreSQL version
13to16. If you're using ECS or Kubernetes, configure an external PostgreSQL database (e.g., AWS RDS). For setup instructions, refer to Configure External PostgreSQL.
Connect Workflow with Appsmith App
To connect workflows with Appsmith app, you need to create workflow query. Follow these steps to create workflow query and connect your workflow:
-
In your Appsmith app, create a New Workflow Query by navigating to the Queries tab and click + New query / API.
-
Choose Workflow Queries to create a new workflow query.
-
Configure the Workflow Query as shown below:
-
Workflow Name: Select your previously created workflow. Give a meaningful name to it.
-
Request Type: Choose
Trigger workflowfrom the dropdown menu. -
Trigger Data: Use this field to pass parameters to your workflow. For example, if the workflow needs a
orderidparameter to initiate processing, pass the parameter in the JSON format. For more information about passing parameters, see Pass Parameters to Workflows.{
"orderid": "ORD00011345"
}
-
-
Click the Run button to trigger the workflow. You will see the below response, where a unique
workflowRunIDis available that indicates the run has successfully started.{
"workflowRunId": "B5XGV5QZ"
}
Now, you can trigger the workflow run whenever an event happens. For example, bind the workflow query to a onClick event of a Button widget and pass appropriate parameters needed by the workflow for processing on button's click event.
An AI client connected through MCP Server can create this query for you with the create_workflow_trigger tool, then wire it to an app event. See Build workflows.
Permissions to trigger a workflow
A workflow query always triggers the published version of the workflow. Who can run it depends on where the workflow is:
- Workflow in the app's workspace: any user who can run the workflow query in the app can trigger the workflow. They don't need a separate permission on the workflow.
- Workflow in another workspace: the query triggers the workflow only for users who have Edit permission on it, either through the Developer or Administrator role in the workflow's workspace or through a custom role's Workflows tab. Other users get a permissions error.
To keep a workflow query working for all app users, keep the workflow in the same workspace as the app. For more information about roles and permissions, see Granular Access Control.
Troubleshooting
Workflow query fails with a permissions error
The workflow query fails with an error that says the workflow doesn't exist or "you don't have required permissions" when the workflow is in a different workspace from the app and the user running the query doesn't have Edit permission on the workflow. To fix it, do one of the following:
- Move the workflow into the app's workspace. This is the safer fix.
- Give the app's users Edit permission on the workflow. Edit also lets them change the workflow.
If you face other issues, contact the support team using the chat widget at the bottom right of this page.
See also
- Debug Workflow - Learn to debug workflows as you build them.
- Pass Parameters to Workflows - Learn how to pass parameters to workflows from the Appsmith app or external systems.
- Workflow Queries - Understand how to use queries within your workflows.
- Workflow Triggers - Explore the available triggers to automate the execution of your workflows.