Sync new API calls to PostgreSQL and notify via Gmail

Recipe ToolsDatabaseMarketingProductivitySales Enablement

What it does

When someone makes a call to the PostgresInsertApi endpoint, this automation inserts a row into the PostgreSQL details table in real time. If the insert succeeds, a confirmation email is sent; if it fails, the error is logged and no retry occurs.

Who it's for

Engineering teams who need to log API calls to a database and track failures by email.

How teams use this

Log API calls to a database

Each call to PostgresInsertApi is automatically recorded in PostgreSQL so the team has a complete audit trail. No manual logging is needed.

Alert the team on insert failures

When a row insert fails, Gmail sends an alert email so the team knows immediately and can investigate. The error is not retried.

Add a second database table for backups

Include an extra PostgreSQL insert step that writes to a backup table only when the first insert succeeds. This requires adding a second insert step to the flow.

Route errors to a Slack channel

Send error notifications to a Slack channel instead of email so the team sees failures in their chat. This requires replacing the Gmail step with a Slack notification.

How it works

  1. Receive the API call. Listen for a new call to the PostgresInsertApi endpoint in real time so the automation starts immediately when invoked.
  2. Insert the row into PostgreSQL. Add a new row to the public.details table in PostgreSQL with the call data so the record is stored and queryable.
  3. Send a confirmation email. Send an email via Gmail to confirm the row was inserted, or notify if an error occurred and no retry will happen.