Automate PostgreSQL with TypeScript

Run read-only queries, execute statements, and commit atomic PostgreSQL transactions with parameterized values and typed results.

query-customers.automation.ts
import { automation, onHttpRequest } from "automate.ax"
import { postgres } from "automate.ax/postgres"

export default automation("Find pro customers", () => {
  onHttpRequest({ scope: "automation" })

  postgres.query({
    sql: `
      select id, email
      from customers
      where plan = $1
      order by created_at desc
    `,
    parameters: ["pro"],
  })
})

What you can do

Actions

  • Run queries in provider-enforced read-only transactions
  • Execute one parameterized read/write statement
  • Commit or roll back ordered statements atomically
  • Pass JSON, dates, byte arrays, and bigint parameters

Triggers

No provider trigger is published for PostgreSQL yet. Use another trigger, then call its actions.

Start automating with PostgreSQL today

Start building