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

# Chatbot User Authentication

> This page contains all the necessary information regrading how you can authenticate users which are coming to your chatbot.

### **Phone Number Authentication Setup**

This guide walks you through integrating an API for phone number verification within your flow. You’ll set up two APIs—one to send the OTP and another to verify it. Follow these steps carefully.

**Step 1: Create the API for Sending OTP**

1. **Navigate to Developer Section**

Go to your platform's **Developer Section**.

2. **Add a New API**

Click on the **Add API** button as shown in the screenshot

<img src="https://mintcdn.com/vitxiconverse/wnzoMmuRo8w5eZia/images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-2.png?fit=max&auto=format&n=wnzoMmuRo8w5eZia&q=85&s=49968ec7838af45575348ba7d49d891a" alt="240 Chatbot User Authentication  Converse Resource C 2 Pn" width="1866" height="1080" data-path="images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-2.png" />

3. Enter an **API Name** (e.g., "Send OTP").

   <img src="https://mintcdn.com/vitxiconverse/wnzoMmuRo8w5eZia/images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-3.png?fit=max&auto=format&n=wnzoMmuRo8w5eZia&q=85&s=a1d7a37d403768ac2a462d7396c5bcea" alt="240 Chatbot User Authentication  Converse Resource C 3 Pn" width="1866" height="1080" data-path="images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-3.png" />
4. **Configure API Details**
   * Choose the appropriate **Method** from the dropdown that is POST

     <img src="https://mintcdn.com/vitxiconverse/wnzoMmuRo8w5eZia/images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-4.png?fit=max&auto=format&n=wnzoMmuRo8w5eZia&q=85&s=aff015662798824ee73cc250ca764fce" alt="240 Chatbot User Authentication  Converse Resource C 5 Pn" width="1866" height="1080" data-path="images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-4.png" />
   * In the **API URL** field, enter the API endpoint provided for sending OTP.
5. **Set Headers**
   * Go to the **Headers** section.
   * Add the required authorization fields:

     * **Authorization Key**: Enter the authorization key provided by the service.
     * **Value**: Your token or key.

     <img src="https://mintcdn.com/vitxiconverse/wnzoMmuRo8w5eZia/images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-5.png?fit=max&auto=format&n=wnzoMmuRo8w5eZia&q=85&s=73b2e6ae25ea212d8a5b497269725d3c" alt="240 Chatbot User Authentication  Converse Resource C 5 Pn" width="1866" height="1080" data-path="images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-5.png" />
6. **Define Request Body Parameters**

* In the **Body** section, enter the parameters as shown in the screenshot:

  * **accountSID**: Obtain from Twilio.
  * **authToken**: Obtain from Twilio.
  * **fromNumber**: Your Twilio phone number.
  * **toNumber**: Map this to the user’s phone number attribute.

  <img src="https://mintcdn.com/vitxiconverse/wnzoMmuRo8w5eZia/images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-6.png?fit=max&auto=format&n=wnzoMmuRo8w5eZia&q=85&s=1dd4d3393e06ae6dfb22463cbe12310a" alt="240 Chatbot User Authentication  Converse Resource C 6 Pn" width="1866" height="1080" data-path="images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-6.png" />

7. **Save API**

   * Click **Save** to store the API configuration.

   <img src="https://mintcdn.com/vitxiconverse/wnzoMmuRo8w5eZia/images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-7.png?fit=max&auto=format&n=wnzoMmuRo8w5eZia&q=85&s=52b5bbd25ef1a20e31438b1ec8ab50bb" alt="240 Chatbot User Authentication  Converse Resource C 6 Pn" width="1866" height="1080" data-path="images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-7.png" />
8. **Map Phone Number Attribute**
   * In the **Attributes** section, select the user’s phone number attribute.
     1. **Save Custom Attribute**
     * In the **Manage API Response** section, choose **Save to Custom Attribute**.

       <img src="https://mintcdn.com/vitxiconverse/wnzoMmuRo8w5eZia/images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-8.png?fit=max&auto=format&n=wnzoMmuRo8w5eZia&q=85&s=c8738a3aed1fb7c861bb89e8644b8a27" alt="240 Chatbot User Authentication  Converse Resource C 8 Pn" width="1866" height="1080" data-path="images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-8.png" />
     * If not already created, create a custom attribute to store the verification status or OTP code.

**Step 2: Create the API for OTP Verification**

1. **Add Another API for OTP Verification**
   * Click **Add API** again.
   * Name this API (e.g., "Verify OTP").

     <img src="https://mintcdn.com/vitxiconverse/wnzoMmuRo8w5eZia/images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-9.png?fit=max&auto=format&n=wnzoMmuRo8w5eZia&q=85&s=bc10efd0fb353c4a15471e1e332d4ee2" alt="240 Chatbot User Authentication  Converse Resource C 9 Pn" width="1866" height="1080" data-path="images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-9.png" />
2. **Set Method and URL**
   * Choose the appropriate **Method** (POST).
   * Enter the **API URL** for verifying OTP.

     <img src="https://mintcdn.com/vitxiconverse/HO3UM7GDZrkP1rM9/images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-10.png?fit=max&auto=format&n=HO3UM7GDZrkP1rM9&q=85&s=2d6b8a8da84e92c3709a437ce0718845" alt="240 Chatbot User Authentication  Converse Resource C 10 Pn" width="1866" height="1080" data-path="images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-10.png" />

     <Info>
       API : [https://api.v7](https://api.v7). Converse.com/integrations/custom-feature/verify-user-otp
     </Info>
3. **Set Headers**
   * Fill in the  header details similar to Step 1.

     <img src="https://mintcdn.com/vitxiconverse/HO3UM7GDZrkP1rM9/images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-11.png?fit=max&auto=format&n=HO3UM7GDZrkP1rM9&q=85&s=65d801d37d80e1dc30920d6356b0a2e6" alt="240 Chatbot User Authentication  Converse Resource C 11 Pn" width="1866" height="1080" data-path="images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-11.png" />
4. **Define Request Body Parameters**
   * In the **Body** section, pass:

     * **systemOtp**: The OTP sent to the user.
     * **userOtp**: The OTP entered by the user.

     <img src="https://mintcdn.com/vitxiconverse/HO3UM7GDZrkP1rM9/images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-12.png?fit=max&auto=format&n=HO3UM7GDZrkP1rM9&q=85&s=2b00ff16e90c8b085d5d3aa02c23db3e" alt="240 Chatbot User Authentication  Converse Resource C 12 Pn" width="1866" height="1080" data-path="images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-12.png" />
5. **Save API**
   * Click **Save**.

     <img src="https://mintcdn.com/vitxiconverse/HO3UM7GDZrkP1rM9/images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-13.png?fit=max&auto=format&n=HO3UM7GDZrkP1rM9&q=85&s=5f698562a14a2a979e961917c97502c5" alt="240 Chatbot User Authentication  Converse Resource C 13 Pn" width="1866" height="1080" data-path="images/platform-guidelines-training/chatbot-user-authentication/240.chatbot_user_authentication__Converse_resource_c-13.png" />

### **Step 3: Integrate APIs into the Chat Flow**

1. **Edit the Chat Flow**
   * Go to **Edit Flow** and open the chat flow you want to edit.
2. **Add API Components**

* **Send OTP** API:
  * Add the **API component** and select the  API created in Step 1.

**Phone Number Input**:

* Add a component to capture the user’s phone number.

**Verify OTP** API:

* Add the **API component** again and select the **Verify OTP** API from Step 2.

3. **Add Delays**

* Add a delay of 5 seconds between sending and verifying OTP, and 2 seconds if re-verifying.
* Configure messages to display whether the OTP was verified successfully or if the user should re-enter it.

This setup enables you to authenticate a user’s phone number seamlessly by sending and verifying an OTP.
