You will build: A feedback table with a public API to read and add rows, a webhook that receives feedback from another tool, a daily report and a page that lists the feedback
Read first: Tour of the editorInteractive page with workflows
In this tutorial you build a small backend without leaving the editor. You store feedback in a native table, expose it with HTTP endpoints, accept it from other tools with a webhook and send yourself a daily summary on a schedule. At the end, a page on your site lists the feedback through the endpoint.
Create the table
Add a table
Open the Tables workspace from the bottom of the left sidebar. Press New next to Tables, type
feedbackand press ↵. The table opens on its Schema tab with one text column,title.Add the columns
Press Add column twice. Name the first column
messageand keep the type Text. Name the secondratingand set its type to Number. Check Required ontitleandrating.Every row also gets
id,createdAtandupdatedAt, so you do not add them.Add a write rule
Under Row rules, type
row.rating >= 1 && row.rating <= 5in Write. Visitors and workflows can now only store ratings from 1 to 5. Leave Read empty, so everyone can read. Press Save schema.Add a row by hand
Switch to the Rows tab and press Add row. Fill in a title, a message and a rating, then press Add row in the panel. Edits in the editor skip the row rules, because you own the site.
The feedback table shows one row in the Rows tab, and the table header shows the Rules badge.
Read rows with an endpoint
Create a server workflow
Open the Logic workspace and switch the toggle at the top from Client to Server. Press + (Add server workflow) and choose HTTP endpoint. Name the workflow
List feedback.Set the trigger
In Trigger, set Method to GET, Path to
/feedbackand Who can call it to Public. The hint under the fields shows the address:/api/feedbackon your site.Query the table
Press Add step and choose Query table under Tables. Type
feedbackin Table; workflows find a table by its name or its id. Set Limit to20. The step card shows its id,s1.Return the rows
Press Add step and choose Return under Server. Set Value to
steps.s1.rows. The value of Return becomes the response of the endpoint.Test it
Press Test run. The run panel streams each step with its result and duration; the Return step shows your row. Every run is kept under Runs.
Add rows with an endpoint
Create a POST endpoint
Add another HTTP endpoint workflow named
Add feedback. Set Method to POST, Path to/feedbackand Who can call it to Public. A GET and a POST can share a path.Insert the row
Add an Insert row step with Table
feedbackand Values{ title: input.title, message: input.message, rating: input.rating }. The JSON body of the request arrives asinput.Return the new row
Add a Return step with Value
steps.s1, the inserted row with itsid.Test with sample input
In Test input, type
{ "title": "Fast support", "message": "Answered in an hour", "rating": 5 }and press Test run. Then change the rating to9and run again: the write rule refuses the row and the run fails.
The Rows tab of the feedback table shows the row from the test run, and the run history shows one succeeded run and one failed run.
Receive a webhook
Create the webhook
Add a server workflow and choose Webhook. Name it
Feedback webhookand set Path to/webhooks/feedback. A webhook always answersPOST.Store the payload
Add an Insert row step with Table
feedbackand the same Values as before. The payload of the webhook arrives asinput.
Send a daily report
Create a schedule
Add a server workflow and choose Schedule. Name it
Daily reportand press the Every day at 09:00 preset. Schedules use UTC, and the hint under the field reads the schedule back to you.Find the low ratings
Add a Query table step with Table
feedbackand Filter[{ column: 'rating', op: 'lte', value: 2 }].Email yourself
Add a Send email step. Set To to
'you@example.com', Subject toDaily feedbackand Text to the expressionsteps.s1.rows.length + ' ratings of 2 or less'. Press Test run to get the email now.
Publish and call the endpoint
Publish to staging
Server workflows save as you edit, but they go live only when you publish. Press Publish in the toolbar, keep Staging selected and confirm. From now on the schedule runs every day on staging.
Call it from a terminal
Run
curl https://<your-staging-address>/api/feedback. The answer is JSON with the run id, its status and the rows inresult.
Show the feedback on a page
Connect your site's API
Open the Data workspace, press + (Add integration) next to Integrations and choose REST API. Set the base URL to your staging address and press Create integration.
Create a query
Press + (Add query) next to Queries and name it
feedback. Pick your integration and the Request operation. In Input, set the path to/api/feedback. Set Response path toresult, keep When it runs on Client and press Run.List the rows
Insert a Collection list on the page. In the Collection list section, set Source to Expression and Items to
queries.feedback.data. Inside the item, bind a text toitem.titleand another toitem.message.
The page lists the feedback from your table, read through your own endpoint. New rows from the POST endpoint or the webhook show up on the next load.
What you learned
- A native table has a schema, a data browser and row rules that apply to visitors and workflows.
- A server workflow starts from an HTTP endpoint, a webhook or a schedule, and Return sets the response.
- Test run runs the draft with sample input and shows every step; publishing puts the workflows live.
Keep going with the next tutorials, or read the guides behind this one: