> 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.

# SMS OTP वेरिफ़िकेशन

![फ़ोन नंबर, OTP कोड और सफल वेरिफ़िकेशन इकट्ठा करती एजेंट बातचीत](/docs/_fern-img/97201c6fdad0c63900236b52726c867d3ff9405fdbd30725858f384653c95803.webp)

## परिचय

यह गाइड बताती है कि [Twilio Verify](https://www.twilio.com/docs/verify/api) को अपने ElevenLabs एजेंट के साथ कैसे इंटीग्रेट करें, ताकि आप कॉलर के फ़ोन नंबर पर OTP भेज सकें और लाइव वॉइस बातचीत के दौरान उनके द्वारा बताए गए कोड को वेरिफ़ाई कर सकें।

आप जानेंगे कि कैसे:

* एक Twilio Verify सर्विस बनाएं और ऑथेंटिकेशन के लिए अपने क्रेडेंशियल्स को Base64-एन्कोड करें।
* [डैशबोर्ड](https://elevenlabs.io/app/agents), [Agents CLI](/docs/hi/eleven-agents/operate/cli) या [ElevenLabs API](/docs/hi/api-reference/introduction) का इस्तेमाल करके दो webhook टूल्स (`send_SMS_verification` और `check_SMS_verification`) कॉन्फ़िगर करें।
* सीक्रेट वैल्यू वाले `Authorization` हेडर से दोनों webhook कॉल्स को ऑथेंटिकेट करें।
* [`skip_turn`](/docs/hi/eleven-agents/customization/tools/system-tools/skip-turn) सिस्टम टूल सक्षम करें, ताकि जब कॉलर को अभी तक कोड नहीं मिला हो, तो एजेंट इंतज़ार करे।

## ज़रूरी शर्तें

* [Twilio Verify](https://www.twilio.com/docs/verify/api) चालू किया हुआ एक Twilio अकाउंट। अगर आपके Twilio Console में Verify उपलब्ध नहीं है, तो [Twilio support](https://support.twilio.com/) या अपनी Twilio अकाउंट टीम के ज़रिए एक्सेस का अनुरोध करें।
* अगर आपका Twilio अकाउंट [trial mode](https://www.twilio.com/docs/guides/how-to-use-your-free-trial-account) में है, तो डेस्टिनेशन फ़ोन नंबर Twilio में सत्यापित caller ID होना चाहिए।

#### Twilio Console में लॉग इन करें

[Twilio Console](https://console.twilio.com/) खोलें।

#### Authenticate (Verify) सर्विस बनाएं

बाईं साइडबार में **Add +** चुनें और एक **Authenticate** (Verify) सर्विस बनाएं।

#### सर्विस को नाम दें

इसे एक स्पष्ट नाम दें (उदाहरण के लिए, `ElevenLabs OTP`)।

#### Verify Service SID कॉपी करें

सर्विस का **Settings** पेज खोलें और **Verify Service SID** कॉपी करें। यह `VA` से शुरू होता है और आपके Account SID से अलग है।

> **Warning**
>
> **आम गलती**: नीचे दिए गए टूल URLs में Authenticate (Verify) सर्विस का अपना **Verify Service SID** (`VA...`) इस्तेमाल करें। पाथ में अपना **Account SID** (`AC...`) न डालें। Verify API को URL में सर्विस SID चाहिए; Account SID इस्तेमाल करने पर `4xx` invalid-parameter errors मिलती हैं।

अपने एजेंट से जोड़ने से पहले रिक्वेस्ट टेस्ट करने के लिए आप console में Twilio API Explorer इस्तेमाल कर सकते हैं।

### क्रेडेंशियल एन्कोड करें और webhook टूल कॉन्फ़िगर करें

#### Basic authentication के लिए अपने Twilio क्रेडेंशियल एन्कोड करें

Twilio Verify, यूज़रनेम के रूप में आपके **Account SID** और पासवर्ड के रूप में **Auth Token** के साथ HTTP Basic authentication इस्तेमाल करता है। दोनों [Twilio Console](https://console.twilio.com/) के होम पेज पर **Account Info** में मिलेंगे।

अपने shell में `ACCOUNT_SID:AUTH_TOKEN` को Base64-encode करें (कोलन से अलग, बिना स्पेस के):

```bash
printf '%s' 'YOUR_ACCOUNT_SID:YOUR_AUTH_TOKEN' | base64
```

आउटपुट कॉपी करें। पूरा `Authorization` header value, `Basic` शब्द, एक स्पेस और वह Base64 स्ट्रिंग होता है। अगले चरणों में इसे टूल secret के रूप में स्टोर करें।

```text
Basic dkFDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==
```

#### \`send_SMS_verification\` और \`check_SMS_verification\` टूल कॉन्फ़िगर करें

`send_SMS_verification`, SMS OTP भेजने के लिए Twilio Verify को कॉल करता है। `check_SMS_verification`, कॉलर के बोले गए अंक सबमिट करता है। दोनों के लिए एक ही Verify Service SID और एक ही `Authorization` secret चाहिए।

#### डैशबोर्ड से जोड़ें

### send_SMS_verification

![फ़ोन नंबर, OTP कोड और सफल सत्यापन इकट्ठा करती एजेंट बातचीत](/docs/_fern-img/9d72a753674c17481e99ea871b1b178cd7791f2da1ec3491ad4786c3fbc9a84e.webp)

अपनी एजेंट सेटिंग्स के **Agent** सेक्शन में **Add Tool** चुनें और **Webhook** चुनें।

| फ़ील्ड | वैल्यू                                                                        |
| ------ | ----------------------------------------------------------------------------- |
| नाम    | `send_SMS_verification`                                                       |
| विवरण  | दिए गए फ़ोन नंबर पर SMS के ज़रिए OTP verification code भेजता है               |
| मेथड   | `POST`                                                                        |
| URL    | `https://verify.twilio.com/v2/Services/YOUR_VERIFY_SERVICE_SID/Verifications` |

`YOUR_VERIFY_SERVICE_SID` को पहले चरण के `VA...` SID से बदलें।

**Authentication header:** **Headers** में, `Authorization` को **Secret** टाइप के रूप में जोड़ें और पूरा value (`Basic ` के बाद Base64) पेस्ट करें। [Webhook tools](/docs/hi/eleven-agents/customization/tools/webhook-tools) देखें।

**Body parameters:** **Content type** को **URL-encoded** (`application/x-www-form-urlencoded`) पर सेट करें। वैल्यू टाइप के रूप में **LLM Prompt** के साथ पैरामीटर जोड़ें:

| डेटा टाइप | आइडेंटिफ़ायर | विवरण                                                               |
| --------- | ------------ | ------------------------------------------------------------------- |
| `string`  | `To`         | E.164 फ़ॉर्मैट में कॉलर का फ़ोन नंबर (उदाहरण के लिए `+14155552671`) |
| `string`  | `Channel`    | डिलीवरी चैनल; `sms` इस्तेमाल करें                                   |

### check_SMS_verification

दूसरा webhook टूल जोड़ें:

| फ़ील्ड | वैल्यू                                                                            |
| ------ | --------------------------------------------------------------------------------- |
| नाम    | `check_SMS_verification`                                                          |
| विवरण  | जाँचता है कि कॉलर का दिया OTP कोड मान्य है या नहीं                                |
| मेथड   | `POST`                                                                            |
| URL    | `https://verify.twilio.com/v2/Services/YOUR_VERIFY_SERVICE_SID/VerificationCheck` |

`send_SMS_verification` के लिए इस्तेमाल किए गए उसी Verify Service SID और `Authorization` secret का उपयोग करें।

**Body parameters:** **URL-encoded**। **LLM Prompt** के साथ `To` (E.164) और `Code` (OTP अंक) जोड़ें।

#### CLI से जोड़ें

> **Note**
>
> एक [workspace secret](/docs/hi/api-reference/workspace/secrets/create) बनाएं, जिसका value पूरा `Authorization` header (`Basic ` के बाद Base64) हो। नीचे दिए गए JSON में secret ID को `YOUR_SECRET_ID` के रूप में डालें।

#### टूल कॉन्फ़िग फ़ाइलें जोड़ें

send टूल को `tool_configs/send_SMS_verification.json` के रूप में सेव करें (`YOUR_VERIFY_SERVICE_SID` को अपने `VA...` SID से बदलें):

```json
{
  "type": "webhook",
  "name": "send_SMS_verification",
  "description": "Sends an OTP verification code via SMS to the provided phone number",
  "api_schema": {
    "url": "https://verify.twilio.com/v2/Services/YOUR_VERIFY_SERVICE_SID/Verifications",
    "method": "POST",
    "content_type": "application/x-www-form-urlencoded",
    "request_headers": {
      "Authorization": { "secret_id": "YOUR_SECRET_ID" }
    },
    "request_body_schema": {
      "type": "object",
      "description": "Twilio Verify start verification parameters",
      "required": ["To", "Channel"],
      "properties": {
        "To": {
          "type": "string",
          "description": "Caller phone number in E.164 format (for example +14155552671)"
        },
        "Channel": {
          "type": "string",
          "constant_value": "sms"
        }
      }
    }
  }
}
```

check टूल को `tool_configs/check_SMS_verification.json` के रूप में सेव करें:

```json
{
  "type": "webhook",
  "name": "check_SMS_verification",
  "description": "Checks whether the OTP code provided by the caller is valid",
  "api_schema": {
    "url": "https://verify.twilio.com/v2/Services/YOUR_VERIFY_SERVICE_SID/VerificationCheck",
    "method": "POST",
    "content_type": "application/x-www-form-urlencoded",
    "request_headers": {
      "Authorization": { "secret_id": "YOUR_SECRET_ID" }
    },
    "request_body_schema": {
      "type": "object",
      "description": "Twilio Verify verification check parameters",
      "required": ["To", "Code"],
      "properties": {
        "To": {
          "type": "string",
          "description": "Same caller number in E.164 format"
        },
        "Code": {
          "type": "string",
          "description": "The OTP digits the caller provided"
        }
      }
    }
  }
}
```

#### टूल रजिस्टर करें

```bash
elevenlabs tools add "send_SMS_verification" --type "webhook" --config-path ./tool_configs/send_SMS_verification.json
elevenlabs tools add "check_SMS_verification" --type "webhook" --config-path ./tool_configs/check_SMS_verification.json
```

#### टूल को अपने एजेंट से जोड़ें

`agent_configs/<agent-name>.json` एडिट करें। `conversation_config.agent.prompt` के अंतर्गत, `tool_ids` में दोनों टूल शामिल करने के लिए सेट करें (`tools.json` या `elevenlabs agents tools list` से IDs इस्तेमाल करें)। फिर push करें:

```bash
elevenlabs agents push --agent "<agent-name>"
```

#### API से जोड़ें

> **Note**
>
> पूरे `Basic ...` header value वाला एक [workspace secret](/docs/hi/api-reference/workspace/secrets/create) बनाएं, फिर उसकी ID को `request_headers` में `secret_id` के रूप में पास करें।

```python
from elevenlabs import ElevenLabs, ToolRequestModel

elevenlabs = ElevenLabs()

send_sms = elevenlabs.conversational_ai.tools.create(
    request=ToolRequestModel(
        tool_config={
            "type": "webhook",
            "name": "send_SMS_verification",
            "description": "Sends an OTP verification code via SMS to the provided phone number",
            "api_schema": {
                "url": "https://verify.twilio.com/v2/Services/YOUR_VERIFY_SERVICE_SID/Verifications",
                "method": "POST",
                "content_type": "application/x-www-form-urlencoded",
                "request_headers": {
                    "Authorization": {"secret_id": "YOUR_SECRET_ID"},
                },
                "request_body_schema": {
                    "type": "object",
                    "description": "Twilio Verify start verification parameters",
                    "required": ["To", "Channel"],
                    "properties": {
                        "To": {
                            "type": "string",
                            "description": "Caller phone number in E.164 format (for example +14155552671)",
                        },
                        "Channel": {
                            "type": "string",
                            "constant_value": "sms",
                        },
                    },
                },
            },
        }
    )
)

check_sms = elevenlabs.conversational_ai.tools.create(
    request=ToolRequestModel(
        tool_config={
            "type": "webhook",
            "name": "check_SMS_verification",
            "description": "Checks whether the OTP code provided by the caller is valid",
            "api_schema": {
                "url": "https://verify.twilio.com/v2/Services/YOUR_VERIFY_SERVICE_SID/VerificationCheck",
                "method": "POST",
                "content_type": "application/x-www-form-urlencoded",
                "request_headers": {
                    "Authorization": {"secret_id": "YOUR_SECRET_ID"},
                },
                "request_body_schema": {
                    "type": "object",
                    "description": "Twilio Verify verification check parameters",
                    "required": ["To", "Code"],
                    "properties": {
                        "To": {
                            "type": "string",
                            "description": "Same caller number in E.164 format",
                        },
                        "Code": {
                            "type": "string",
                            "description": "The OTP digits the caller provided",
                        },
                    },
                },
            },
        }
    )
)

elevenlabs.conversational_ai.agents.update(
    agent_id="agent_7101k5zvyjhmfg983brhmhkd98n6",
    conversation_config={
        "agent": {
            "prompt": {
                "tool_ids": [send_sms.id, check_sms.id],
            },
        },
    },
)
```

```typescript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";

const elevenlabs = new ElevenLabsClient();

const sendSms = await elevenlabs.conversationalAi.tools.create({
  toolConfig: {
    type: "webhook",
    name: "send_SMS_verification",
    description: "Sends an OTP verification code via SMS to the provided phone number",
    apiSchema: {
      url: "https://verify.twilio.com/v2/Services/YOUR_VERIFY_SERVICE_SID/Verifications",
      method: "POST",
      contentType: "application/x-www-form-urlencoded",
      requestHeaders: {
        Authorization: { secretId: "YOUR_SECRET_ID" },
      },
      requestBodySchema: {
        type: "object",
        description: "Twilio Verify start verification parameters",
        required: ["To", "Channel"],
        properties: {
          To: {
            type: "string",
            description: "Caller phone number in E.164 format (for example +14155552671)",
          },
          Channel: {
            type: "string",
            constantValue: "sms",
          },
        },
      },
    },
  },
});

const checkSms = await elevenlabs.conversationalAi.tools.create({
  toolConfig: {
    type: "webhook",
    name: "check_SMS_verification",
    description: "Checks whether the OTP code provided by the caller is valid",
    apiSchema: {
      url: "https://verify.twilio.com/v2/Services/YOUR_VERIFY_SERVICE_SID/VerificationCheck",
      method: "POST",
      contentType: "application/x-www-form-urlencoded",
      requestHeaders: {
        Authorization: { secretId: "YOUR_SECRET_ID" },
      },
      requestBodySchema: {
        type: "object",
        description: "Twilio Verify verification check parameters",
        required: ["To", "Code"],
        properties: {
          To: {
            type: "string",
            description: "Same caller number in E.164 format",
          },
          Code: {
            type: "string",
            description: "The OTP digits the caller provided",
          },
        },
      },
    },
  },
});

await elevenlabs.conversationalAi.agents.update("agent_7101k5zvyjhmfg983brhmhkd98n6", {
  conversationConfig: {
    agent: {
      prompt: {
        toolIds: [sendSms.id, checkSms.id],
      },
    },
  },
});
```

> **Note**
>
> अगर आप डैशबोर्ड में **`Channel`** को LLM से भरने वाले फ़ील्ड के रूप में कॉन्फ़िगर करते हैं, तो अपने system prompt में निर्देश जोड़ें, ताकि मॉडल हमेशा `sms` पास करे। ऊपर दिए CLI और API उदाहरण `constant_value` / `constantValue` के साथ `sms` को तय रखते हैं, इसलिए मॉडल चैनल नहीं चुनता।

#### \`skip_turn\` सिस्टम टूल चालू करें

कोड पढ़ने से पहले कॉलर को SMS मिलने में अक्सर कुछ समय लगता है। `skip_turn` के बिना, एजेंट रुकावट के दौरान बोल सकता है या prompts दोहरा सकता है।

#### डैशबोर्ड से जोड़ें

**Tools** में **Add Tool** चुनें, **System tool** चुनें और **Skip turn** चालू करें। आगे कोई कॉन्फ़िगरेशन ज़रूरी नहीं है।

#### CLI से जोड़ें

`agent_configs/<agent-name>.json` में, `conversation_config.agent.prompt` के अंतर्गत `built_in_tools.skip_turn` को `null` (defaults) पर सेट करें, ताकि Skip turn चालू हो जाए, फिर चलाएं:

```bash
elevenlabs agents push --agent "<agent-name>"
```

#### API से जोड़ें

```python
from elevenlabs import ElevenLabs

elevenlabs = ElevenLabs()

elevenlabs.conversational_ai.agents.update(
    agent_id="agent_7101k5zvyjhmfg983brhmhkd98n6",
    conversation_config={
        "agent": {
            "prompt": {
                "built_in_tools": {
                    "skip_turn": None,
                },
            },
        },
    },
)
```

```typescript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";

const elevenlabs = new ElevenLabsClient();

await elevenlabs.conversationalAi.agents.update("agent_7101k5zvyjhmfg983brhmhkd98n6", {
  conversationConfig: {
    agent: {
      prompt: {
        builtInTools: {
          skipTurn: null,
        },
      },
    },
  },
});
```

अगर webhook टूल बनाते समय आपने पहले ही `tool_ids` सेट कर लिए हैं, तो उसे बदलने के बजाय उसी `prompt` ऑब्जेक्ट में `built_in_tools` मर्ज करें।

सिस्टम prompt में निर्देश जोड़ें, ताकि मॉडल को पता हो कि इसे कब कॉल करना है, उदाहरण के लिए:

```text
When the caller indicates they are still waiting to receive the OTP code — for example,
"hold on", "I haven't received it yet", or "give me a second" — use the skip_turn tool
to wait silently rather than speaking. Do not repeat the prompt or ask for the code again
until the caller indicates they are ready.
```

जानकारी के लिए [Skip turn](/docs/hi/eleven-agents/customization/tools/system-tools/skip-turn) देखें।

#### सिस्टम prompt में फ़्लो ऑर्केस्ट्रेट करें

ऐसा system prompt इस्तेमाल करें जो टूल का क्रम साफ़ तौर पर बताए, उदाहरण के लिए:

```text
You are a secure verification agent. When you need to verify a caller's identity:

1. Ask for their phone number if you do not already have it.
2. Standardize the number to E.164 for tool calls: a leading plus, country code, then digits only, no spaces (for example +14155552671).
3. Call send_SMS_verification with their number and Channel set to "sms".
4. Tell the caller: "I've sent a verification code to your phone. Please read it out when you're ready."
5. If the caller says they haven't received the code yet or asks for a moment, use skip_turn to wait silently.
6. Once the caller provides the code, call check_SMS_verification with their number and the code.
7. If the response status is "approved", proceed with the verified flow.
8. If the code is invalid, let the caller know and offer to resend.
```

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

### Twilio `60200` — अमान्य पैरामीटर (HTTP 400)

जब अनुरोध URL या बॉडी Verify API की अपेक्षाओं से मेल नहीं खाता, तो Twilio ऐसा बॉडी लौटा सकता है:

```json
{
  "code": 60200,
  "message": "Invalid parameter",
  "more_info": "https://www.twilio.com/docs/errors/60200",
  "status": 400
}
```

**क्या जांचें:** पाथ में Authenticate (Verify) सेवा सेटिंग्स से आपका **Verify Service SID** (`VA...`) होना चाहिए। `.../Services/{Sid}/...` में अपना **Account SID** (`AC...`) डालना `60200` की आम वजह है। अमान्य पैरामीटर के अन्य मामलों के लिए Twilio का [60200](https://www.twilio.com/docs/errors/60200) दस्तावेज़ देखें।

### Twilio `20003` — प्रमाणीकरण त्रुटि — कोई क्रेडेंशियल नहीं दिया गया (HTTP 401)

जब `Authorization` हेडर मौजूद नहीं होता, गलत फ़ॉर्मैट में होता है या भेजा नहीं जाता, तो Twilio यह जवाब दे सकता है:

```json
{
  "code": 20003,
  "message": "Authentication Error - No credentials provided",
  "more_info": "https://www.twilio.com/docs/errors/20003",
  "status": 401
}
```

**क्या जांचें:** टूल को `Authorization` हेडर भेजना चाहिए, जिसका मान पूरा `Basic <base64>` स्ट्रिंग हो (जिसमें `Basic` शब्द और Base64 आउटपुट से पहले एक स्पेस शामिल हो)। Base64 इनपुट में बिना अतिरिक्त स्पेस या नई लाइन के बिल्कुल `ACCOUNT_SID:AUTH_TOKEN` होना चाहिए। पुष्टि करें कि दोनों webhook टूल में इस हेडर के साथ secret जुड़ा है। [20003](https://www.twilio.com/docs/errors/20003) देखें।

### अन्य समस्याएं

* **ट्रायल मोड में नंबर अस्वीकृत:** Twilio Console में [Verified phone numbers](https://console.twilio.com/us1/develop/phone-numbers/manage/verified) खोलें और टेस्ट करने से पहले सुनिश्चित करें कि डेस्टिनेशन नंबर सूची में है।
* **एजेंट कॉलर के ऊपर बोल रहा है:** पुष्टि करें कि **Skip turn** चालू है और सिस्टम प्रॉम्प्ट मॉडल को बताता है कि कॉलर को समय चाहिए होने पर `skip_turn` का इस्तेमाल करे।