# Popin Service Webview Integration Documentation

### Overview

This document explains how to integrate the Popin Service into your customer application using a webview. The Popin Service allows seamless access to Popin’s communication widget directly from within your app.

***

### Base URL

```
https://widget01.popin.to/standalone
```

***

### Required Query Parameters

| Parameter | Type   | Description                                                                                    | Example           |
| --------- | ------ | ---------------------------------------------------------------------------------------------- | ----------------- |
| `token`   | string | (Mandatory) This token can be obtained from the Popin Dashboard.                               | `token=abc123xyz` |
| `popin`   | string | (Mandatory) Must always be set to `open`. It triggers the Popin widget to launch in open mode. | `popin=open`      |

***

### Optional Query Parameters

| Parameter | Type   | Description                                                                       | Example                     |
| --------- | ------ | --------------------------------------------------------------------------------- | --------------------------- |
| `name`    | string | (Optional) The name of the customer using the app.                                | `name=Anubhav%20Jaiswal`    |
| `mobile`  | string | (Optional) The customer’s mobile number, used for identification or verification. | `mobile=9792521396`         |
| `email`   | string | (Optional) The customer’s email address.                                          | `email=anubhav@example.com` |

***

### Example Full URL

```
https://widget01.popin.to/standalone?token=abc123xyz&popin=open&name=Anubhav%20Jaiswal&mobile=9792521396&email=anubhav@example.com
```

***

### Integration Steps

#### 1. Retrieve Token

* Log in to your Popin Dashboard.
* Navigate to your project or campaign settings.
* Locate and copy the Access Token associated with your widget.

#### 2. Load URL in Webview

* In your mobile or web application, load the above URL inside a webview component.
* Pass the token and any optional parameters dynamically as per your logged-in customer’s data.

***

### Permissions

Ensure that the application has **camera and microphone permissions** before launching the webview.

These permissions are required for Popin to enable video and audio-based communication features.

#### On Mobile Platforms:

* **iOS**: Request `NSCameraUsageDescription` and `NSMicrophoneUsageDescription` permissions.
* **Android**: Request `CAMERA` and `RECORD_AUDIO` permissions.

***

### Error Handling

* If the token is missing or invalid, the Popin widget will not load.
* Always verify that a valid token is provided before initializing the webview.

***

### Best Practices

* Always **encode query parameters** (especially `name` and `email`) to ensure compatibility.
* For enhanced security, **tokens should be generated or validated server-side**.
* Keep your tokens confidential and **avoid exposing them in publicly accessible code**.

***

### Support

If you face any issues integrating or loading the Popin service, please contact Popin Support through the dashboard or at:

**📧** [**support@popin.to**](mailto:support@popin.to)

***

Let me know if you'd like this exported in `.md` format for GitBook import.
