Build a workflow on the canvas

You will build the backend of a contact form by hand, node by node: a web address that receives a message, checks it, saves it to a table and answers. It's the best way to understand how every workflow on Ubex works, including the ones Vira builds for you.

20 min8 stepsIntermediate

Here is what you will have at the end:

Flow Start POST /contact Data Validator → check valid invalid Table create → saved Simple Output 201 received Simple Output 400 {{check.error}}
Five nodes. The trigger starts the run, each node does one job, and the data travels between them as variables.

Create the table

The messages need somewhere to live. Open My Data → Add data → Create a table → Blank table, name it messages, and add these columns:

Column Type Settings
name Text Required
email Email Required
message Long Text Required
status Select Options: new, handled

Click Create table. Every row also gets an _id, a created_at and an updated_at by itself.

Create the workflow

Open Studio → Create → Workflow. Name it Contact form, pick a project, and create it. The canvas opens with one node already on it: Flow Start.

A quick tour of the canvas: the nodes and the lines between them in the middle, zoom and the mini map at the bottom right, Active, History and Publish at the top right, and Ask Vira at the bottom left.

Give it an address

Click Flow Start and set the trigger:

  • Trigger: API, so the workflow runs when something calls its address
  • Path: contact
  • Allowed Methods: POST, the method forms use to send data
  • Require Authentication: off, because anyone visiting your site may send a message
  • Rate Limit: 10, so nobody can flood you with messages

The full address appears on Flow Start, ready to copy. When a form sends {"name": "...", "email": "...", "message": "..."}, the next nodes can read {{name}}, {{email}} and {{message}}.

Check the request

Double-click the canvas to open Add Node, and add a Data Validator. Connect Flow Start to it, then set:

  • Input Data: {"name": "{{name}}", "email": "{{email}}", "message": "{{message}}"}
  • Root Data Type: Object
  • Fields: name String, Required, Max Length 100. email String, Required, with a Pattern for emails such as ^[^@]+@[^@]+$. message String, Required, Min Length 2.
  • Output Variable: check

The Data Validator has two exits, valid and invalid. Bad requests now take the invalid path, before anything is saved.

Save the message

Add a Table node and connect the validator's valid exit to it:

  • Table: messages
  • Method: create
  • Arguments:
{ "data": { "name": "{{name}}", "email": "{{email}}", "message": "{{message}}", "status": "new" } }
  • Output Variable: saved

After it runs, {{saved._id}} holds the new row's id.

Send the answers

Add a Simple Output after the Table node:

  • Response Type: JSON
  • Status Code: 201
  • Output Data: {"id": "{{saved._id}}", "status": "received"}

Add a second Simple Output to the validator's invalid exit:

  • Response Type: JSON
  • Status Code: 400
  • Output Data: {"error": "{{check.error}}"}

Your workflow is complete: every path ends with an answer.

Publish and test it

Click Publish, and make sure Active is on. Then send it a message from a terminal, using the address from Flow Start:

curl -X POST "https://workflow.ubex.ai/api/v1/<code>/contact" \
  -H "Content-Type: application/json" \
  -d '{"name": "Ana", "email": "ana@example.com", "message": "Hello!"}'

You should get 201 and the new id. Try it without an email, and you get 400 with the reason.

Then check what happened:

  • My Data → messages: your row is there, with status new.
  • Activity: each call is a run. Click one to open its Execution Logs and see what every node received and produced.

Connect it to your web app

If you built a web app with Qira, keep the workflow in the same project as the app, and just ask her: "send the contact form to the contact endpoint". In code, a Ubex web app calls an endpoint of its own project by path:

await fetch("/api/contact", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ name, email, message }),
});

You now know the pattern behind every endpoint: a trigger, a check, an action and an answer. Next, see how Vira builds a workflow from a sentence, or read about every node in the docs.

Finished all the steps?

0 of 8 steps done

Ready to build?

Open Ubex in another tab and follow along: every step matches what you see in the app.

Open Ubex