# Webview Callback Schema

### **Open Deeplink**

**Example use case**: Webview wants to redirect user to cart page on a button click.

```jsx
{
  "user_id":"xyz",
  "eventName": "OPEN_DEEPLINK",
  "data": {
    "deepLink": string,
    [key: string]: string
  }
}
```

### **Close**

**Example use case:** User wants to close the webview by clicking on close button.

```jsx
{
  "user_id":"xyz",
  "eventName": "CLOSE",
  "data": null
}
```

### **Share**

**Example use case:** User might want to use social share for referral or sharing reward the user won.

```jsx
{
  "user_id":"xyz",
  "eventName": "SHARE"
  "data": {
    "channelName": "WHATSAPP" | "OTHERS",
    "text": "string",
    "image": "string"
  }
}
```

### Invalid Campaign Id

**Example use case:** In case of providing an [invalid campaignId](/sdk/mobile-sdks.md#handling-invalid-campaign-id) in the open campaign method, the wallet opens up by default. The following event is also triggered and can be consumed to handle the case in a custom manner.

```json
{
  "user_id":"xyz",
  "eventName": "CG_INVALID_CAMPAIGN_ID"
  "data": {
    "campaignId":"xyz-abc-123"
    "message":"Invalid campaignId, opening Wallet"
   }
}
```

### Analytics

**Example use case:** Capture Webview interaction events like page loads, clicks directly on the app

```json
{
   "user_id":"xyz",
   "eventName":"ANALYTICS",
   "data":{
      "timestamp":"2022-07-11T09:16:48.917Z",
      "event_name":"xyz",
      "event_properties":{
         "lorem":"ipsum"
      }
   }
}
```

[Check all analytics events schema here](/schema/webview-callback-schema/analytics-event-schema.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.customerglu.com/schema/webview-callback-schema.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
