# 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="/files/mc2IKuaTgXtA6qkZWSom" 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="/files/ckti38uf9uW0JLZth76k" 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="/files/L3MPmHn1uXWJNjycjOVE" 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="/files/x0vEszR5zeclvtCHeufp" %}

**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="/files/dzkkfzOUMdlv9H5PrSCL" 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="/files/7bBnS9yjTL3RZBAvjm6z" 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.


---

# 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://documents.cxgenie.ai/integrations-and-connections/platform-integration/lark/lark-app-setup.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.
