Skip to content

MySQL New Row

MySQL New Row is a starting component: it starts the flow when new rows appear in a table of your MySQL or MariaDB database, 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 MySQL 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 MySQL credential with read access to the table. See Credentials.

FieldWhat it does
Credential (required)The MySQL credential of your database.
Table (required)The table to watch, for example orders.
Cursor Column (required)A column whose value only grows: an auto-increment 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.
FilterAn optional condition to watch only some rows, written like the filter of the MySQL 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.
DataUsed to test the component: paste a sample of what arrives and run the flow to see the result.

Advanced options

FieldWhat it does
DatabaseThe database that holds the table. Empty: the one in the credential.
Max Rows per RunMaximum rows delivered per run (1–500, default 50). The rest arrive in the following checks.
Process Existing RowsWhen 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

  1. Deploy a version of the flow. See Versions and publishing.
  2. In the component, below its fields, click Activate. The API access window opens on the New Items Triggers tab.
  3. 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.
  4. 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.

  1. Add MySQL New Row with the database credential, Table set to support_tickets, Cursor Column to id and Filter to status = 'open'.
  2. Connect Data to an agent that reads {subject} and {message} and proposes a category, and that to a MySQL component that stores it.
  3. Deploy the flow and activate it from the component.

Good practices

  • Use the auto-increment id as 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 session is opened read-only and with a maximum time per query: 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.