Supabase कनेक्टर
customer engagement automation के लिए database records, user authentication data, file storage events, और real-time changes sync करने हेतु अपने Supabase project को कनेक्ट करें।
अवलोकन
| Property | Value |
|---|---|
| Platform | Supabase |
| Category | Database & Backend |
| Setup Complexity | Easy |
| Official Integration | Yes |
| Data Synced | Users, Tables, Storage, Events |
| Available Skills | 11 |
| API Type | REST (PostgREST) + Realtime WebSocket |
| Official Docs | supabase.com/docs |
विशेषताएं
- Auto-generated REST API, PostgREST के माध्यम से किसी भी Postgres table पर CRUD operations, बिना किसी code के
- Auth user sync, Supabase Auth users (email, phone, social logins) को अपने engagement platform से sync करें
- Real-time subscriptions, किसी भी table पर INSERT, UPDATE, DELETE events को real-time में सुनें
- Row Level Security, सभी API access secure multi-tenant data के लिए Postgres RLS policies का सम्मान करता है
- Storage integration, file uploads ट्रैक करें और Storage buckets में assets manage करें
- Edge Functions, custom logic और webhooks के लिए serverless Deno functions invoke करें
- Full-text search, API के माध्यम से Postgres full-text search capabilities का लाभ उठाएं
पूर्वावश्यकताएं
शुरू करने से पहले, सुनिश्चित करें कि आपके पास हैं:
- एक Supabase project (app.supabase.com)
- आपके project का API URL और API keys (Settings → API में पाया जाता है)
- API access वाला एक Tajo account
API Keys
Supabase दो keys प्रदान करता है: anon (public, RLS का सम्मान करती है) और service_role (RLS को bypass करती है, admin access)। server-side integrations के लिए service_role और client-side के लिए anon का उपयोग करें।
प्रमाणीकरण
Supabase API key authentication का उपयोग करता है। हर request के लिए apikey header आवश्यक है और user-scoped access के लिए वैकल्पिक रूप से एक Authorization bearer token।
# anon key का उपयोग (RLS का सम्मान करती है)curl 'https://<project_ref>.supabase.co/rest/v1/customers' \ -H "apikey: <SUPABASE_ANON_KEY>" \ -H "Authorization: Bearer <SUPABASE_ANON_KEY>"
# service_role key का उपयोग (RLS को bypass करती है)curl 'https://<project_ref>.supabase.co/rest/v1/customers' \ -H "apikey: <SUPABASE_SERVICE_ROLE_KEY>" \ -H "Authorization: Bearer <SUPABASE_SERVICE_ROLE_KEY>"कॉन्फ़िगरेशन
बेसिक सेटअप
connectors: supabase: enabled: true project_url: "https://xyzcompany.supabase.co" api_key: "${SUPABASE_SERVICE_ROLE_KEY}"
# Data sync options sync: users: true tables: - customers - orders - products storage: true realtime: true
# Supabase Auth users को contacts से map करें user_mapping: email: email phone: SMS user_metadata.full_name: FIRSTNAME created_at: SIGNUP_DATEField Mapping
Supabase table columns को engagement platform attributes से map करें:
Default User Mappings
| Parameter | Type | Description |
|---|---|---|
email required | string | Supabase Auth से User email (unique identifier) |
phone optional | string | SMS/WhatsApp engagement के लिए Phone number |
user_metadata.full_name optional | string | Auth user metadata से Display name |
user_metadata.avatar_url optional | string | Profile image URL |
created_at optional | timestamp | Account creation timestamp |
last_sign_in_at optional | timestamp | engagement scoring के लिए सबसे हालिया login |
app_metadata.provider optional | string | Auth provider (email, google, github, आदि) |
confirmed_at optional | timestamp | Email confirmation timestamp |
Custom Table Mapping
table_mapping: customers: # Column → Attribute mapping email: email full_name: FIRSTNAME company: COMPANY plan: SUBSCRIPTION_PLAN mrr: MONTHLY_REVENUE created_at: SIGNUP_DATE
orders: # events के रूप में ट्रैक करें sync_as: events event_name: "order_placed" properties: total: amount status: order_status items: line_itemsAPI Endpoints
Supabase REST API आपके database schema से https://<ref>.supabase.co/rest/v1/ पर auto-generated होता है।
| Endpoint | Method | विवरण |
|---|---|---|
/rest/v1/{table} | GET | filtering, ordering, pagination के साथ rows क्वेरी करें |
/rest/v1/{table} | POST | rows insert करें (bulk और upsert को support करता है) |
/rest/v1/{table} | PATCH | filters से match होने वाले rows अपडेट करें |
/rest/v1/{table} | DELETE | filters से match होने वाले rows हटाएं |
/rest/v1/rpc/{function} | POST | Postgres function call करें |
/auth/v1/signup | POST | नया user बनाएं |
/auth/v1/token?grant_type=password | POST | password के साथ sign in करें |
/auth/v1/user | GET | वर्तमान user प्राप्त करें |
/auth/v1/admin/users | GET | सभी users list करें (service_role) |
/storage/v1/object/{bucket}/{path} | POST | file upload करें |
/storage/v1/object/list/{bucket} | POST | bucket में files list करें |
/functions/v1/{function_name} | POST | Edge Function invoke करें |
Filtering Operators
| Operator | विवरण | उदाहरण |
|---|---|---|
eq | बराबर | ?status=eq.active |
neq | बराबर नहीं | ?status=neq.deleted |
gt, gte | से अधिक | ?amount=gt.100 |
lt, lte | से कम | ?created_at=lt.2024-01-01 |
like, ilike | Pattern match | ?name=ilike.%john% |
in | Array में | ?status=in.(active,trial) |
is | Null check | ?deleted_at=is.null |
Events
Auth Events
| Event | Trigger | उपयोग मामला |
|---|---|---|
user.signed_up | नया user registration | Welcome series |
user.signed_in | User login | Activity tracking |
user.updated | Profile changes | Data sync |
user.deleted | Account deletion | Cleanup workflows |
Database Events (Realtime)
| Event | Trigger | उपयोग मामला |
|---|---|---|
INSERT | नया row जोड़ा गया | नए order/customer notifications |
UPDATE | Row modified | Status change workflows |
DELETE | Row removed | Churn detection |
Webhook Events
| Event | Trigger | उपयोग मामला |
|---|---|---|
auth.user.created | webhook के माध्यम से User signup | onboarding trigger करें |
storage.object.created | File uploaded | Asset processing |
कोड उदाहरण
कनेक्टर शुरू करें
import { TajoClient } from '@tajo/sdk';import { createClient } from '@supabase/supabase-js';
const tajo = new TajoClient({ apiKey: process.env.TAJO_API_KEY,});
// Supabase project कनेक्ट करेंawait tajo.connectors.connect('supabase', { projectUrl: process.env.SUPABASE_URL, serviceRoleKey: process.env.SUPABASE_SERVICE_ROLE_KEY,});Users को Contacts से Sync करें
// सभी Supabase Auth users को contacts के रूप में sync करेंawait tajo.connectors.sync('supabase', { type: 'full', resources: ['users'],});
// Incremental sync (केवल नए/बदले गए users)await tajo.connectors.sync('supabase', { type: 'incremental', resources: ['users'], since: '2024-01-01T00:00:00Z',});Real-time Changes सुनें
// engagement triggers के लिए नए orders की subscribe करेंconst supabase = createClient( process.env.SUPABASE_URL, process.env.SUPABASE_SERVICE_ROLE_KEY);
supabase .channel('orders') .on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'orders' }, async (payload) => { // Tajo को एक event के रूप में forward करें await tajo.events.track({ email: payload.new.customer_email, event: 'order_placed', properties: { order_id: payload.new.id, total: payload.new.total, items: payload.new.line_items, }, }); } ) .subscribe();Query और Segment
// targeted campaigns के लिए plan द्वारा customers क्वेरी करेंconst { data: proUsers } = await supabase .from('customers') .select('email, full_name, plan, mrr') .eq('plan', 'pro') .gt('mrr', 100) .order('mrr', { ascending: false });
// campaign targeting के लिए Brevo list से sync करेंawait tajo.lists.addContacts(PRO_LIST_ID, proUsers);Rate Limits
API Rate Limits
Supabase rate limits आपके plan पर निर्भर करते हैं। Free tier: 500 requests/minute। Pro: 1,000 requests/second। Enterprise limits के लिए Supabase से संपर्क करें।
| Plan | Rate Limit | Realtime Connections |
|---|---|---|
| Free | 500 req/min | 200 concurrent |
| Pro | 1,000 req/s | 500 concurrent |
| Team | 2,000 req/s | 1,000 concurrent |
| Enterprise | Custom | Custom |
समस्या निवारण
सामान्य समस्याएं
| समस्या | कारण | समाधान |
|---|---|---|
| 401 Unauthorized | अमान्य या expired API key | Supabase Dashboard → Settings → API में API keys जांचें |
| 403 Forbidden | RLS policy access block कर रही है | admin operations के लिए service_role key का उपयोग करें, या RLS policies जांचें |
| कोई realtime events नहीं | table के लिए Realtime enable नहीं | Database → Replication में enable करें → publication में table जोड़ें |
| खाली query results | RLS सभी rows filter कर रहा है | सत्यापित करें कि RLS policies authenticated role को read करने की अनुमति देती हैं |
| Storage upload fail | Bucket policies | जांचें कि Storage bucket public सेट है या इसमें सही RLS policies हैं |
Debug Mode
connectors: supabase: debug: true log_level: verbose log_queries: true log_realtime: trueConnection Test करें
tajo connectors test supabase# ✓ API connection successful# ✓ Auth endpoint accessible# ✓ Tables readable (12 tables found)# ✓ Storage accessible (3 buckets)# ✓ Realtime connection established# ✓ Edge Functions available (4 functions)सर्वोत्तम प्रथाएं
- service_role key केवल server-side उपयोग करें, इसे client code में कभी expose न करें
- सभी tables पर RLS enable करें, service_role के साथ भी, defense in depth के लिए RLS के साथ design करें
- Event-driven sync के लिए Realtime का उपयोग करें, changes के लिए polling की तुलना में अधिक efficient
- Operations को batch करें, high-volume operations के लिए bulk inserts और
infilter का उपयोग करें - User metadata map करें, signup के दौरान engagement-relevant fields को
user_metadataमें store करें - Webhooks के लिए Edge Functions का उपयोग करें, low-latency handling के लिए Supabase Edge Functions के साथ incoming webhooks process करें
सुरक्षा
- API Key Authentication, सभी requests के लिए valid API keys आवश्यक
- Row Level Security (RLS), प्रति row Postgres-native access control
- JWT Verification, Auth tokens signed JWTs हैं जो हर request पर verified होते हैं
- SSL/TLS, transit में सभी connections encrypted
- SOC 2 Type II, Supabase SOC 2 compliant है
- Network Restrictions, paid plans पर Optional IP allowlisting