nanderoo / db-webhooks

Database Webhooks for Postgres

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🪝 DB Webhooks

Database Webhooks for Postgres

DB Webhooks is a utility for Postgres that triggers webhooks when rows are inserted, updated, or deleted. It uses database triggers that send low-latency websocket messages to a lightweight Go application. This application then calls the configured webhook(s) with a JSON payload that includes specified values from the database row.

DB Webhooks Flow

Use Cases

  • Send notifications: Slack, Email, Text Message, Push Notification
  • Call serverless functions: AWS Lambda, Google Cloud Functions, Azure Functions
  • Trigger analytics events: Segment, Mixpanel, Amplitude
  • Connect to automation platforms: Zapier, Trigger.dev, Pipedream

Steps

  1. Data added in Postgres table (INSERT)
  2. Postgres trigger notifies DB Webhooks web server via websocket message
  3. DB Webhooks formats data and sends webhook(s)

Get Started

Note: This install script only supports Linux distros that use yum and systemd and will install the application as a service. If you want to run the program as a native executable you can download and build the repo instead.

wget https://raw.githubusercontent.com/portola-labs/db-webhooks/main/install-linux.sh
chmod +x install-linux.sh
./install-linux.sh

The script will:

  • Download the repo and necessary dependencies
  • Prompt you to add your environment variables to the .env file
    • Note: Make sure the user you add has read permissions on the specified database
    • Note: This is also where you'll specific the POST request URL and body, which can contain templated variables which map to the column names whose values you want to include in the request
  • Build the executable and run it as a service
  • Create the trigger creation SQL which then has to be executed manually

Roadmap

Right now the alpha version only supports monitoring INSERTS from one table and firing one webhook. We'll be adding support for:

  • Triggers on any number of tables
  • Monitoring for different operations (INSERT, UPDATE, DELETE)
  • Filters and mapping options the row data to the POST request

Let us know your feedback or feature requests! You can submit and issue or contact us at eric@inquery.io

About

Database Webhooks for Postgres

License:Other


Languages

Language:Go 55.3%Language:Shell 44.7%