PostgreSQL API without a backend: write and read data through a webhook

A PostgreSQL API without a backend in nana800 takes three blocks: a webhook receives the request, the PostgreSQL block runs your SQL with data from that request, and the response block returns the result. Values from the request reach the database as separate parameters, so quotes and semicolons in them cannot break your SQL. All you need is a database reachable from the internet and its login and password.

Build it in the builder

What you can automate

  • Save website leads to your own table and return the new record id to the form
  • Serve data from the database to a site or mobile app at an address like /orders/:id
  • Update the order status when a payment service or CRM sends a notification to the webhook
  • Collect events and logs from your services in one table without a separate server
  • Work with a database on Supabase, Neon, AWS RDS, Render or your own server

How to set it up

  1. 1

    Prepare the database

    The database must be reachable from the internet: the block does not accept localhost or internal network addresses (10.x.x.x, 192.168.x.x). It is a good idea to create a separate database user with access to the needed tables only.

  2. 2

    Add the webhook

    A webhook is an address your site or app sends data to. Create a scheme and add the webhook trigger. For writing, set method to POST and a path like /leads. For reading, GET with a path parameter works, for example /orders/:id: the value from the path lands in params, the request body in body.

  3. 3

    Connect PostgreSQL

    Add the Postgres external database operation block. Paste the connection string from your provider panel, or fill in the host, port, database name, user and password. SSL mode require fits most cloud databases, disable is for servers without SSL.

  4. 4

    Write the SQL query

    In the SQL query field write a command such as INSERT INTO leads (name, phone) VALUES (...) RETURNING id, and put fields from the webhook body in place of the values. A quoted value together with all text inside the quotes becomes one parameter. A query with variables must be a single command.

  5. 5

    Return the result

    Add the webhook response block. Return result of the PostgreSQL block through body json: the found rows, or the changed rows for INSERT, UPDATE and DELETE with RETURNING. The number of rows is in row_count. Keep status OK.

  6. 6

    Turn the scheme on and test it

    A webhook answers only while its scheme is on. Click the API button in the builder, fill in the body on the Try it tab and click Send: the request really writes to the database. If something is wrong, the reason is in the error_text field of the block. An enabled scheme costs $0.0042 per hour.

Pricing

A run of a Webhook block costs up to $0.001, a run of a PostgreSQL block costs $0.002. Every month the balance is topped up to $3.50 for free, an enabled scheme costs $0.0042 per hour.

Services in this connection

  • Webhook

    Receive website leads and service events with a webhook and answer requests with no server and no code. Free balance every month, no card needed.

  • PostgreSQL

    Connect your PostgreSQL database to nana800: save leads, look up orders and update statuses with an SQL query in a scheme. Free balance every month, no card needed.

Frequently asked questions

The webhook costs the same as a basic block: $1 per 1,000 requests. A PostgreSQL query costs twice as much as a basic block, and the webhook response block is free. An enabled scheme costs $0.0042 per hour. Your balance is topped up to $3.50 every month, but a scheme kept on around the clock spends most of it on hours.

Yes. Variables are not pasted into the query text, they reach the database as separate values (parameters), so SQL injection is not possible. Wrap a table or column name that comes from a variable in double quotes to make it an escaped identifier.

Any database reachable from the internet: Supabase, Neon, AWS RDS, Render or one on your own server. SSL mode require usually fits cloud databases. The verify-full mode also checks the server certificate, and you can paste the CA certificate of your provider for it.

The block waits up to 10 seconds to connect, and the SQL query itself is stopped after 15 seconds. Keep heavy selects small with LIMIT and indexes. The webhook caller waits up to 120 seconds for the scheme to answer.

Click the API button in the builder. It lists the addresses of all webhooks in the scheme with a copy button, describes their parameters and answers, lets you send a test request and download an OpenAPI file for Postman or Insomnia. The address is public, so check a secret header with the condition block.

Members with read-only access see asterisks instead of the password. It never appears in run logs either, so you can show the run history of the scheme to colleagues.

Build your first scheme for free

Sign-up is free and needs no card. Every month the balance is topped up to $3.50 for free, enough for about 3,500 runs of basic blocks.

Build it in the builder