How to run a workflow via REST API

Hi,

I have developed a workflow. I now want to build an app, which will take an input from user, call this workflow, output a response, which then i can parse and show on the UI.

Can someone guide me steps to build this application and the workflow. I specifically want the workflow to be called as a webhook from the UI

Queries and code quickstart

1 Like

Hey @Pranjal_Vatsa, welcome to the forum!

So the steps for this are:

  1. Import a Workflow into your app
  2. Define in that Workflow import the data you want to send to the workflow
  3. Define what triggers the workflow
  4. Within the workflow, add a response block with the data how you want to return it to your UI.

Below screenshots for each step:

1 Importing a workflow

  1. Define data to be sent to workflow (I'm getting a buggy interface for some reason...) MAke sure you select "Finished" in your "Run until" option

  1. Define what triggers the workflow: this can be a button or a script, treat teh workflow as you would treat any other query.

  2. Add a response block to your workflow:

When the workflow finishes, you will find this data in workflow1.data (or whatever name you gave your workflow query in the app.

Hope this helps!

4 Likes

Hi @Pranjal_Vatsa — great explanation from @MiguelOrtiz!

I was just about to share something similar. Here's a quick demo app that uses a workflow to calculate dog years and return a custom message. Hope it helps!

appCalculatingDogYearsWithWorkflow.json (9.9 KB)
dogYearsCalculatorWorkflow.json (14.2 KB)

1 Like

Both of the above responses are right on the mark, @Pranjal_Vatsa! I hope you find them helpful. :+1: Let us know if you have any additional questions.

Thanks guys @MiguelOrtiz @Shawn_Optipath and Darren .. i was able to run the workflow via REST API. thanks for the support.

2 Likes