# Lark App Setup

## **1. Create a Lark Custom App**

### **1.1 Open Lark Developer Console**

1. Go to [**https://open.larksuite.com**](https://open.larksuite.com)
2. Select **Developer Console**
3. Under **Custom Apps**, click **Create Custom App**

***

### **1.2 Fill in App Information**

<figure><img src="https://3928771814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcrYvzbvjeUPqcy0srNQ9%2Fuploads%2FWvYFoBH01KK3K5DTbUDn%2F2025-11-20%2017%2043%2023.png?alt=media&#x26;token=e02d10ba-5a98-43eb-8a94-8fbf2640260b" alt=""><figcaption></figcaption></figure>

In the “Create custom app” window:

* **Name:** e.g., *CXG Bot*
* **Description:**

  > This app is used to authenticate our Lark workspace with CX Genie. It allows the bot to receive messages, send automated replies, and support workflow automation.
* **Icon:** Select from built-in icons or upload your own
* Click **Create**

*(image reference: Create custom app)*

***

## **2. Retrieve App ID & App Secret**

<figure><img src="https://3928771814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcrYvzbvjeUPqcy0srNQ9%2Fuploads%2FFkHQnVaS7sgHt7w5wgFx%2F2025-11-20%2017%2045%2053.png?alt=media&#x26;token=d205c240-57ef-4928-86f7-f642663848b9" alt=""><figcaption></figcaption></figure>

After the app is created:

1. Open the app in Developer Console
2. Go to **Credentials & Basic Info**
3. Copy:
   * **App ID**
   * **App Secret**

You will need these values in CX Genie.

***

## **3. Add Redirect URL**

CX Genie requires the Lark app to include a specific redirect URL for OAuth.

### **3.1 Open Security Settings**

Navigate to:

**Security Settings → Redirect URLs**

### **3.2 Add Redirect URL**

Paste the following URL:

```
https://app.cxgenie.ai/integrations/lark
```

Click **Add** and **Publish Changes**.

<figure><img src="https://3928771814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcrYvzbvjeUPqcy0srNQ9%2Fuploads%2FKYZMk7m1xAoZilPHkyil%2Fimage.png?alt=media&#x26;token=d77630ee-2ade-48c8-a8fe-d76a402a41b1" alt=""><figcaption></figcaption></figure>

***

## **4. Configure Permissions & Scopes**

Your Lark App must include several required OAuth scopes and message permissions.

### **4.1 Open Permissions & Scopes**

Go to:

**Permissions & Scopes → User Permissions / Tenant Permissions**

### **4.2 Required Permissions**

The following scopes must be added (examples below; full list depends on your use case):

* `offline_access`
* `im:message`
* `im:message:send_as_bot`
* `im:chat:read`
* `docs:document.content:read`
* `contact:user.base:readonly`
* `wiki:node:read`

These scopes are also included in your uploaded export file:&#x20;

{% file src="<https://3928771814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcrYvzbvjeUPqcy0srNQ9%2Fuploads%2FHKfKSOVN4yiG75Wr06ti%2FScopes.txt?alt=media&token=5fe6ee3d-f9a5-4443-9a3a-ecf6fdecd2d0>" %}

**Note:**\
Some scopes require **Admin Approval** before they become active.

Click **Save** and **Publish**.

***

## **5. Configure Events**

CX Genie requires message events to be pushed to the webhook.

### **5.1 Open Events & Callbacks**

Navigate to:

**Events & Callbacks → Event Configuration**

### **5.2 Request URL (Webhook)**

Set the request URL to:

```
https://api.cxgenie.ai/api/v1/lark/webhook
```

<figure><img src="https://3928771814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcrYvzbvjeUPqcy0srNQ9%2Fuploads%2FIoeHUv7rqpuFZ2zPndNc%2Fimage.png?alt=media&#x26;token=8c5c476b-a51e-44aa-ba77-6b0cf83a6415" alt=""><figcaption></figcaption></figure>

***

## **6. Configure Callback Settings**

Callback settings are used for Lark interactive components (e.g., card buttons).

### **6.1 Open Callback Configuration**

Navigate to:

**Events & Callbacks → Callback Configuration**

### **6.2 Add Callback URL**

Use the same URL:

```
https://api.cxgenie.ai/api/v1/lark/webhook
```

<figure><img src="https://3928771814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcrYvzbvjeUPqcy0srNQ9%2Fuploads%2FlKytaY2TDR87vmZ42DG7%2Fimage.png?alt=media&#x26;token=1fd85c17-48b9-4b1c-bb13-45b6f46a989c" alt=""><figcaption></figcaption></figure>

***

## **7. Publish the App**

To activate all configurations:

1. Go to **Version Management & Release**
2. Click **Create Version** (if needed)
3. Submit for release
4. Admin must approve the app if required

Once published, your Lark App is ready for use.
