> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# Supabase

आपका रिसेप्शनिस्ट Supabase की REST API के ज़रिए कॉल की जानकारी Supabase टेबल में सेव कर सकता है और फ़ोन नंबर से कॉल करने वाले को खोज सकता है। नीचे दिया गया सेटअप row-level security के साथ आपके प्रोजेक्ट की public key इस्तेमाल करता है, इसलिए रिसेप्शनिस्ट केवल वही कर सकता है जिसकी आप अनुमति देते हैं।

> **Warning**
>
> किसी वेबहुक टूल में कभी भी `service_role` या secret key न डालें। ये कुंजियां row-level security को बायपास करती हैं
> और आपके डेटाबेस का पूरा एक्सेस देती हैं।

## शुरू करने से पहले

Supabase डैशबोर्ड में **Project Settings** → **API Keys** खोलें और **publishable** key या पुरानी **anon** key कॉपी करें। आपके प्रोजेक्ट का URL `https://PROJECT_REF.supabase.co` है।

## डेटाबेस तैयार करें

इसे **SQL Editor** में चलाएं। इससे एक ऐसी टेबल बनती है जिसमें आपका रिसेप्शनिस्ट केवल डेटा डाल सकता है, और एक फ़ंक्शन बनता है जो सटीक फ़ोन नंबर से एक ग्राहक लौटाता है। फ़ंक्शन `name`, `plan`, `notes`, और `phone` कॉलम वाली मौजूदा `customers` टेबल मानकर चलता है, इसलिए नामों को अपने स्कीमा के अनुसार बदलें।

कॉल करने वाले इस फ़ंक्शन से ग्राहकों की सूची नहीं देख सकते: सटीक फ़ोन नंबर पता न होने पर यह कुछ नहीं लौटाता।

```sql
create table callback_requests (
  id bigint generated always as identity primary key,
  created_at timestamptz not null default now(),
  caller_name text not null,
  phone text not null,
  reason text not null
);

alter table callback_requests enable row level security;

create policy "Receptionist can add callback requests"
  on callback_requests for insert to anon
  with check (true);

create function find_customer_by_phone(phone text)
returns table (name text, plan text, notes text)
language sql stable security definer set search_path = public
as $$
  select c.name, c.plan, c.notes from customers c where c.phone = find_customer_by_phone.phone limit 1;
$$;

revoke execute on function find_customer_by_phone from public;
grant execute on function find_customer_by_phone to anon;
```

## टूल बनाएं

दोनों टूल के लिए **Integrations** पर जाएं, **Add integration** चुनें, **Webhook Tool** चुनें और ये रिक्वेस्ट हेडर जोड़ें:

| हेडर            | वैल्यू                                                                   |
| --------------- | ------------------------------------------------------------------------ |
| `apikey`        | आपकी publishable या anon key                                             |
| `Authorization` | `Bearer ` और उसके बाद anon key। publishable key के लिए इसे शामिल न करें। |

### कॉलबैक अनुरोध सेव करें

| फ़ील्ड                    | वैल्यू                                                                     |
| ------------------------- | -------------------------------------------------------------------------- |
| **नाम**                   | `save_callback_request`                                                    |
| **विवरण**                 | "जब भी आप कॉल करने वाले से फ़ॉलो-अप का वादा करें, कॉलबैक अनुरोध सेव करें।" |
| **तरीका**                 | POST                                                                       |
| **URL**                   | `https://PROJECT_REF.supabase.co/rest/v1/callback_requests`                |
| **बॉडी पैरामीटर**         | `caller_name`, `phone`, और `reason` (सभी string, required)                 |
| **एजेंट्स को असाइन करें** | **Receptionist**                                                           |

### ग्राहक खोजें

| फ़ील्ड                    | वैल्यू                                                                                                                           |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| **नाम**                   | `find_customer`                                                                                                                  |
| **विवरण**                 | "फ़ोन नंबर से कॉल करने वाले का अकाउंट खोजें। जब कोई कॉल करने वाला अपने प्लान या अकाउंट के बारे में पूछे, तब इसका इस्तेमाल करें।" |
| **तरीका**                 | POST                                                                                                                             |
| **URL**                   | `https://PROJECT_REF.supabase.co/rest/v1/rpc/find_customer_by_phone`                                                             |
| **बॉडी पैरामीटर**         | `phone` (string, required): "कॉल करने वाले का फ़ोन नंबर E.164 फ़ॉर्मैट में, उदाहरण के लिए +14155550123।"                         |
| **एजेंट्स को असाइन करें** | **Receptionist**                                                                                                                 |

हर टूल पर **Enable** चुनें, फिर कॉलबैक अनुरोध के साथ [अपने रिसेप्शनिस्ट को टेस्ट करें](/docs/hi/reception-ai/receptionist/testing)। पंक्ति **Table Editor** में दिखाई देगी।

## समस्या निवारण

| समस्या                                       | क्या जाँचें                                                                              |
| -------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `new row violates row-level security policy` | insert policy को `anon` role को टारगेट करना चाहिए।                                       |
| `Could not find the function`                | बॉडी पैरामीटर का नाम फ़ंक्शन के आर्ग्युमेंट जैसा ही होना चाहिए, यहाँ `phone`।            |
| 401 `Invalid API key`                        | publishable key के साथ `Authorization` हेडर हटा दें।                                     |
| ग्राहक नहीं मिलते                            | फ़ोन नंबर E.164 फ़ॉर्मैट में स्टोर करें, उसी फ़ॉर्मैट में जो आपका रिसेप्शनिस्ट भेजता है। |