> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pnta.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Supabase

> Trigger push notifications directly from your Supabase database using PNTA

## Prerequisites

* Supabase project
* PNTA account with project ID (`prj_XXXXXXXXX`)
* Platform keys configured in [PNTA Dashboard](https://app.pnta.io) (see [Platform Keys Setup](/resources/platform-keys))
* Devices registered via a PNTA client SDK

## Setup Steps

### 1. Connect Your Supabase Project

1. Go to **Integrations** in the [PNTA Dashboard](https://app.pnta.io)
2. Click **Connect** on the Supabase integration
3. Authorize PNTA via OAuth to access your Supabase project
4. PNTA will automatically set up the required PostgreSQL triggers and webhooks

<Info>
  PNTA uses OAuth to connect to your Supabase project. No manual database
  configuration or SQL is required - everything is set up automatically.
</Info>

### 2. Create a Notification Rule

1. Once connected, go to the **Supabase** section in PNTA Dashboard
2. Click **Create Rule**
3. Select the **table** you want to monitor
4. Choose the **event type**: insert, update, or delete
5. Select a **metadata field** to match devices (e.g., `user_id`) - this links rows to registered devices via their metadata

### 3. Configure Notification Templates

Write your notification title and body using `{{field}}` placeholders that get filled from your row data:

* **Title**: `Order {{order_id}} shipped!`
* **Body**: `Hi {{customer_name}}, your order is on the way.`

Placeholders map directly to column names in your table.

### 4. Add Conditions (Optional)

Add conditions to filter which devices receive the notification based on their metadata:

* Only notify devices where metadata `role` equals `admin`
* Only notify devices where metadata `region` equals `eu`
* Combine multiple conditions for precise targeting

These are just examples — you can use the default device system identifiers or your own custom metadata.

## Resources

<CardGroup cols={2}>
  <Card title="Supabase" icon="bolt" href="https://supabase.com">
    Learn more about Supabase
  </Card>
</CardGroup>
