PostgreSQL New Row
PostgreSQL New Row is a starting component: it starts the flow when new rows appear in a table of your PostgreSQL database (Supabase or Neon too), for example an order, a support ticket or a new customer. There is no need to create triggers or webhooks in the database: once activated, NappAI checks the table every so often, in read-only mode, and runs the flow with the rows added since the previous check.
When to use it
- Every new ticket in the support table should be classified by an agent and reported to the team.
- Every order your shop stores in PostgreSQL should be sent to another system or to a spreadsheet.
- You want to react to new customers of an in-house application without touching its code.
Configuration
You need a Postgres SQL credential with read access to the table and its schema. See Credentials.
| Field | What it does |
|---|---|
| Credential (required) | The Postgres SQL credential of your database. |
| Table (required) | The table to watch, for example orders. |
| Cursor Column (required) | A column whose value only grows: a serial or identity id, or a creation date such as created_at. NappAI remembers the last value seen and asks for greater ones on each check. Default: id. |
| Filter | An optional condition to watch only some rows, written like the filter of the Postgres component: status = 'pending' AND total > 100. Text goes in single quotes; IS NULL, IS NOT NULL and LIKE 'A%' are allowed, but not parentheses or free SQL. |
| Data | Used to test the component: paste a sample of what arrives and run the flow to see the result. |
Advanced options
| Field | What it does |
|---|---|
| Schema | The schema that holds the table. Default: public. |
| Max Rows per Run | Maximum rows delivered per run (1–500, default 50). The rest arrive in the following checks. |
| Process Existing Rows | When on, the rows already in the table when the trigger is activated are processed too. Off (default): only rows added from then on. |
| Check Every (seconds) | How often the table is checked (60 to 86,400; default 60). |
Activate the trigger
- Deploy a version of the flow. See Versions and publishing.
- In the component, below its fields, click Activate. The API access window opens on the New Items Triggers tab.
- Click Activate. NappAI connects to the database, checks that the table, the column and the filter exist and records the current last value. If something is wrong, the alert says what.
- The tab shows whether the trigger is Listening, the last value seen, the last check and, if any, the failed checks in a row with their reason. If you change the table, the column or the filter in the component, it shows Out of sync: click Update. To stop listening, click Deactivate.
Output
The Data output returns one item per new row, with its columns as fields ({id}, {subject}, {customer_email}…). Dates arrive in ISO format. All new rows of a check arrive in a single run, as a list, and the following components process them one by one.
Example
A support team wants every new ticket classified automatically.
- Add PostgreSQL New Row with the database credential, Table set to
support_tickets, Cursor Column toidand Filter tostatus = 'open'. - Connect Data to an agent that reads
{subject}and{message}and proposes a category, and that to a Postgres component that stores it. - Deploy the flow and activate it from the component.
Good practices
- Use the
serialoridentityidas cursor whenever there is one: it is the most reliable. A modification date column (updated_at) also works, but then the flow also fires when a row is edited. - Several rows with the same date are neither lost nor repeated: NappAI remembers which ones of that instant it already delivered.
- A column that does not grow (a random UUID, a name) cannot be a cursor and is rejected on activation.
- If the database does not answer, the trigger waits longer and longer between attempts (up to one hour) and shows it in the tab.
Security
- The transaction is opened read-only and with a maximum time per query (
statement_timeout): the trigger cannot modify the database. - The filter is not pasted into the query: it is parsed and each value travels separately, so SQL injection is not possible.
- Use a credential whose user can only read the tables you watch.
Related components
- MySQL New Row: the same for MySQL.
- Postgres: reads and writes PostgreSQL rows.
- RSS New Item and HTTP New Item: new items of a feed or an API.