PostgreSQL integration: insert, find and update data from a scheme

The PostgreSQL integration in nana800 runs an SQL query against your database on every scheme run: it saves a lead, finds an order or changes a status. You only need the connection string, and values from other blocks are sent as separate parameters, so a quote in a name cannot break the query. Each query costs $0.002, and your balance is topped up to $3.50 for free every month.

Build it in the builder
  • Block run: $0.002
  • Free every month: $3.50
  • No card needed

What you can do

  • Save website leads, orders and bot messages as rows in your tables
  • Look up data on request, such as an order by number or a customer by phone or email, and pass it further down the scheme
  • Update and delete rows: mark an order as paid, move it to a new status, clean up old records
  • Write any SQL: JOINs, aggregates, your own functions and RETURNING to get the inserted row right away
  • Put values from other blocks into the query with no SQL injection risk: they are sent to the database as parameters
  • Connect to cloud databases on Supabase, Neon, AWS RDS and Render or to your own server, with or without SSL

Blocks in the builder

  • PostgreSQL query

    Action · $0.002 per run

    Runs an SQL query against your PostgreSQL database: SELECT, INSERT, UPDATE, DELETE or any other command. Returns the rows found, the number of affected rows and an error text if the query fails.

How to set it up

  1. 1

    Get access to the database

    Copy the connection string from your hosting panel, like postgresql://user:password@host:5432/dbname, or note the host, port, database name, user and password. The database must accept connections from the internet: the block refuses localhost and private network addresses like 192.168.x.x.

  2. 2

    Create a scheme and add a trigger

    Create a scheme in the builder and add the trigger that brings the data: a webhook for website leads, a message to a Telegram bot or a schedule. For the first test the button trigger is enough, it starts the scheme by hand.

  3. 3

    Connect the PostgreSQL block

    Add the Postgres external database operation block. Paste the whole connection string or fill in the host, port, database name, user and password. Keep the SSL mode at require, which fits Supabase, Neon, AWS RDS and most cloud databases. If your server has no SSL, choose disable.

  4. 4

    Write the SQL query

    In the SQL query field write the command, for example an insert into your leads table, and put fields from the trigger where the values go. Wrap text values in single quotes, numbers can go without quotes. Add RETURNING * at the end and the block returns the inserted row.

  5. 5

    Turn the scheme on and test it

    Turn the scheme on, press the button trigger and open the block result: result holds the rows, row_count their number, and error_text the database answer if something went wrong. When it works, keep the scheme on. While it is on, it costs $0.0042 per hour.

Popular connections

  • Webhook + PostgreSQL

    Build your own PostgreSQL API without a backend: a webhook takes the data, an SQL query writes or reads rows and sends the result back. Free balance every month.

Frequently asked questions

Each database query costs $0.002. An enabled scheme costs $0.0042 per hour. Your balance is topped up to $3.50 for free every month, no card needed. A scheme kept on around the clock for a month spends most of that on scheme hours.

No. The block connects only to databases reachable from the internet: localhost, 10.x.x.x, 172.16.x.x to 172.31.x.x, 192.168.x.x and names like .local are blocked. A cloud database (Supabase, Neon, AWS RDS, Render) works, and so does your own server with a public address and an open database port.

Yes. Values from other blocks are not pasted into the query text, they go to the database as separate parameters. A quote or a semicolon in a customer name will not break the query or run an extra command. The database password is hidden from project readers and never goes to the logs.

A query that uses values from other blocks must be a single SQL command. The database stops a query that runs longer than 15 seconds, and the block waits up to 10 seconds for a connection. Use LIMIT on large selects so you do not carry extra rows down the scheme.

If the server runs without encryption, choose the disable SSL mode. If the server certificate fails the check, choose require, or pick verify-full and paste the CA certificate of your provider. The block writes a hint about the right mode into error_text.

The scheme is built with the mouse, but the database query itself is SQL. Typical tasks need one line: find an order by number, add a lead, change a status. If a developer runs your database, ask them to write the query once, and the scheme does the rest.

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