# Conversation Widget

Conversation Widget can be seamlessly embedded into your internal CRM or portal by following the steps below:

**Embedding the Conversation Widget in an iFrame**

To embed the conversation widget, use the following URL format in an iFrame:

```
https://conversation-widget.gallabox.com/conversations/phone/{{ContactPhoneNumberwithCountryCode}}?name={{ContactName}}&channelId={{GallaboxChannelId}}
```

**Parameters:**

* **ContactPhoneNumberwithCountryCode**: The WhatsApp user’s phone number with the country code, excluding the ‘+’. Example: `919900000001`.
* **ContactName**: The WhatsApp user’s contact name.
* **GallaboxChannelId**: The Channel ID is required if your account has multiple WhatsApp channels. It can be found in Gallabox under `Settings > WhatsApp Channel > Channel Id`.

**Example URL:**

```
https://conversation-widget.gallabox.com/conversations/phone/919900000001?name=Lakshmanan&channelId=647062b51e3c77d2741188cb
```

**Note**: When loading the widget, the Gallabox account member must be logged in to their account.

### **Auto-login Widget with a Specific Member**

1. **Get Token from Server API Call**

   Use the following `curl` command to get the authentication token:

   ```bash
   curl --location 'https://server.gallabox.com/auth/v2/login' \
   --header 'Content-Type: application/json' \
   --data-raw '{
     "email": "you@example.com",
     "password": "your_password"
   }'
   ```
2. **Load iFrame with Auth URL with Token and Redirect URL**

   Use the token obtained in the previous step to load the iFrame with the following URL format:

   ```
   https://conversation-widget.gallabox.com/auth?token={{AuthToken}}&redirectUrl={{ConversationWidgetUrl}}
   ```

   **Parameters:**

   * **AuthToken**: The member’s authentication token obtained from the server API call.
   * **ConversationWidgetUrl**: The URL of the conversation widget in the format:

     ```
     https://conversation-widget.gallabox.com/conversations/phone/{{ContactPhoneNumberwithCountryCode}}?name={{ContactName}}&channelId={{GallaboxChannelId}}
     ```

   If the customer has enabled 2FA or user logs-in with new IP,  widget will display OTP screen. After successful verifcation user will the navigated to desired redirect url\
   **Example URL:**

<pre><code><strong>https://conversation-widget.gallabox.com/auth?token=your_token&#x26;redirectUrl=https%3A%2F%2Fconversation-widget.gallabox.com%2Fconversations%2Fphone%2F919900000001%3Fname%3DLakshmanan%26channelId%3D647062b51e3c77d2741188cb
</strong></code></pre>

By following these instructions, you can successfully integrate the Gallabox Conversation Widget into your internal systems, ensuring seamless communication via WhatsApp through your portal or CRM.
