# 员工入职

当应用订阅该事件后，如果有新员工入职（例如，通过管理后台添加成员、调用创建用户 API），则会触发该事件。

## 前提条件

你需要在应用中配置事件订阅，这样才可以在事件触发时接收到事件数据。了解事件订阅可参见[事件订阅概述](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM)。

## 注意事项

该事件有部分字段权限要求，你可以参考相应的参数描述获取参数所需的权限。只有当应用开通了相应的字段权限后，才可以成功接收到完整的事件体数据。申请权限的具体操作，参见[申请 API 权限](https://open.feishu.cn/document/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN)。

## 事件

基本 | &nbsp;
---|---
事件类型 | contact.user.created_v3
支持的应用类型 | Custom App、Store App
权限要求<br>**订阅该事件所需的权限，开启其中任意一项权限即可订阅**<br>开启任一权限即可 | 获取通讯录基本信息(contact:contact.base:readonly)<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>以应用身份访问通讯录(contact:contact:access_as_app)
字段权限要求 | **注意事项**：该接口返回体中存在下列敏感字段，仅当开启对应的权限后才会返回；如果无需获取这些字段，则不建议申请<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户基本信息(contact:user.base:readonly)<br>获取用户组织架构信息(contact:user.department:readonly)<br>查看成员的虚线上级 ID(contact:user.dotted_line_leader_info.read)<br>获取用户受雇信息(contact:user.employee:readonly)<br>查看成员工号(contact:user.employee_number:read)<br>获取用户性别(contact:user.gender:readonly)<br>查询用户职级(contact:user.job_level:readonly)<br>获取用户 user ID(contact:user.employee_id:readonly)<br>获取用户手机号(contact:user.phone:readonly)<br>获取用户邮箱信息(contact:user.email:readonly)<br>查询用户所属的工作序列(contact:user.job_family:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
推送方式 | [Webhook](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM)

### 事件体

名称 | 类型 | 描述
---|---|---
schema | string | 事件模式
header | event_header | 事件头
event_id | string | 事件 ID
event_type | string | 事件类型
create_time | string | 事件创建时间戳（单位：毫秒）
token | string | 事件 Token
app_id | string | 应用 ID
tenant_key | string | 租户 Key
event | \- | \-
object | user_event | 员工信息。
open_id | string | 用户的 open_id，应用内用户的唯一标识。不同用户 ID 的说明参见 [用户相关的 ID 概念](https://open.feishu.cn/document/home/user-identity-introduction/introduction)。
union_id | string | 用户的 union_id，是应用开发商发布的不同应用中同一用户的标识。不同用户 ID 的说明参见 [用户相关的 ID 概念](https://open.feishu.cn/document/home/user-identity-introduction/introduction)。
user_id | string | 用户的 user_id，租户内用户的唯一标识。不同用户 ID 的说明参见 [用户相关的 ID 概念](https://open.feishu.cn/document/home/user-identity-introduction/introduction)。<br>**字段权限要求**：<br>获取用户 user ID(contact:user.employee_id:readonly)
name | string | 用户名。<br>**数据校验规则**：<br>- 最小长度：`1` 字符<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户基本信息(contact:user.base:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
en_name | string | 用户英文名。<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户基本信息(contact:user.base:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
nickname | string | 用户别名。<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户基本信息(contact:user.base:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
email | string | 邮箱。<br>**字段权限要求**：<br>获取用户邮箱信息(contact:user.email:readonly)
enterprise_email | string | 企业邮箱。<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户基本信息(contact:user.base:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
job_title | string | 职务。
mobile | string | 手机号。<br>**字段权限要求**：<br>获取用户手机号(contact:user.phone:readonly)
gender | int | 性别。<br>**可选值有**：<br>- 0：未知<br>- 1：男<br>- 2：女<br>- 3：其他<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户性别(contact:user.gender:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
avatar | avatar_info | 用户头像信息。<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户基本信息(contact:user.base:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
avatar_72 | string | 72*72 像素头像链接。
avatar_240 | string | 240*240 像素头像链接。
avatar_640 | string | 640*640 像素头像链接。
avatar_origin | string | 原始头像链接。
status | user_status | 用户状态。通过 is_frozen、is_resigned、is_activated、is_exited 布尔值类型参数进行展示。<br>用户状态的流转逻辑可参见[用户资源介绍](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/field-overview#4302b5a1)。<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户受雇信息(contact:user.employee:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
is_frozen | boolean | 是否为暂停状态。<br>**可能值有**：<br>- true：是<br>- false：否
is_resigned | boolean | 是否为离职状态。<br>**可能值有**：<br>- true：是<br>- false：否
is_activated | boolean | 是否为激活状态。<br>**可能值有**：<br>- true：是<br>- false：否
is_exited | boolean | 是否为主动退出状态。主动退出一段时间后用户状态会自动转为已离职。<br>**可能值有**：<br>- true：是<br>- false：否
is_unjoin | boolean | 是否为未加入状态，需要用户自主确认才能加入企业或团队。<br>**可能值有**：<br>- true：是<br>- false：否
department_ids | string\[\] | 用户所属部门的 ID 列表。<br>**注意**：该参数实际无返回值。该事件返回的用户所属部门 ID 请通过 old_object.department_ids 参数获取。<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户组织架构信息(contact:user.department:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
leader_user_id | string | 用户直属主管的用户 open_id 。了解用户 ID 可参见[用户相关的 ID 概念](https://open.feishu.cn/document/home/user-identity-introduction/introduction)。<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户受雇信息(contact:user.employee:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
city | string | 城市。<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户受雇信息(contact:user.employee:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
country | string | 国家。<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户受雇信息(contact:user.employee:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
work_station | string | 工位。<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户受雇信息(contact:user.employee:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
join_time | int | 入职时间。秒级时间戳格式。<br>**数据校验规则**：<br>- 取值范围：`1` ～ `2147483647`<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户受雇信息(contact:user.employee:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
employee_no | string | 工号。<br>**字段权限要求（满足任一）**：<br>获取用户受雇信息(contact:user.employee:readonly)<br>查看成员工号(contact:user.employee_number:read)<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
employee_type | int | 员工类型。<br>**说明**：支持读取自定义员工类型的 int 值。如果该参数的取值不为 1 ~ 5，则你可调用[查询人员类型](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/list)接口查询相应的自定义员工类型信息（employee_type 对应 **查询人员类型** 接口返回的 enum_value）。<br>**可选值有**：<br>- 1：正式员工<br>- 2：实习生<br>- 3：外包<br>- 4：劳务<br>- 5：顾问<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户受雇信息(contact:user.employee:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
orders | user_order\[\] | 用户排序信息。用于标记通讯录下组织架构的人员顺序，人员可能存在多个部门中，且有不同的排序。<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户组织架构信息(contact:user.department:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
department_id | string | 排序信息对应的部门 ID，表示用户所在的、且需要排序的部门。该 ID 均包含在用户所属部门 ID 列表（department_ids）的参数值当中。
user_order | int | 用户在其直属部门内的排序，数值越大，排序越靠前。
department_order | int | 用户所属的多个部门间的排序，数值越大，排序越靠前。
is_primary_dept | boolean | 标识部门是否为用户的唯一主部门，主部门为用户所属部门中排序第一的部门（department_order 最大）。
custom_attrs | user_custom_attr\[\] | 自定义字段信息。了解自定义字段可参见[自定义字段资源介绍](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/custom_attr/overview)。<br>**字段权限要求（满足任一）**：<br>以应用身份读取通讯录(contact:contact:readonly_as_app)<br>获取用户受雇信息(contact:user.employee:readonly)<br>以应用身份访问通讯录(contact:contact:access_as_app)<br>读取通讯录(contact:contact:readonly)
type | string | 自定义字段类型。<br>**可能值有：**<br>- `TEXT`：文本<br>- `HREF`：网页<br>- `ENUMERATION`：枚举<br>- `PICTURE_ENUM`：图片<br>- `GENERIC_USER`：用户
id | string | 自定义字段 ID。
value | user_custom_attr_value | 自定义字段取值。
text | string | - 字段类型为 TEXT 时，该参数返回定义的字段值。<br>- 字段类型为 HREF 时，该参数返回定义的网页标题。
url | string | 字段类型为 HREF 时，该参数返回定义的默认 URL。
pc_url | string | 字段类型为 HREF 时，如果为 PC 端设置了 URL，则该参数返回定义的 PC 端 URL。
option_id | string | 字段类型为 `ENUMERATION` 或 `PICTURE_ENUM` 时，该参数返回定义的选项 ID。
option_value | string | 选项类型的值，即用户详情或自定义字段中选中的选项值。
name | string | 选项类型为图片时，图片的名称。
picture_url | string | 选项类型为图片时，图片的链接。
generic_user | custom_attr_generic_user | 字段类型为 `GENERIC_USER` 时，该参数返回定义的引用人员信息。
id | string | 引用人员的 user_id。关于用户 ID 的具体说明可参见[用户相关的 ID 概念](https://open.feishu.cn/document/home/user-identity-introduction/introduction)。
type | int | 用户类型。目前固定取值为 1，表示用户。
job_level_id | string | 职级 ID。<br>**字段权限要求**：<br>查询用户职级(contact:user.job_level:readonly)
job_family_id | string | 序列 ID。<br>**字段权限要求**：<br>查询用户所属的工作序列(contact:user.job_family:readonly)
dotted_line_leader_user_ids | string\[\] | 虚线上级的用户 ID。<br>**字段权限要求**：<br>查看成员的虚线上级 ID(contact:user.dotted_line_leader_info.read)

### 事件体示例
```json
{
    "schema": "2.0",
    "header": {
        "event_id": "5e3702a84e847582be8db7fb73283c02",
        "event_type": "contact.user.created_v3",
        "create_time": "1608725989000",
        "token": "rvaYgkND1GOiu5MM0E1rncYC6PLtF7JV",
        "app_id": "cli_9f5343c580712544",
        "tenant_key": "2ca1d211f64f6438"
    },
    "event": {
        "object": {
            "open_id": "ou_7dab8a3d3cdcc9da365777c7ad535d62",
            "union_id": "on_576833b917gda3d939b9a3c2d53e72c8",
            "user_id": "e33ggbyz",
            "name": "张三",
            "en_name": "San Zhang",
            "nickname": "Sunny Zhang",
            "email": "zhangsan@gmail.com",
            "enterprise_email": "demo@mail.com",
            "job_title": "软件工程师",
            "mobile": "12345678910",
            "gender": 1,
            "avatar": {
                "avatar_72": "https://foo.icon.com/xxxx",
                "avatar_240": "https://foo.icon.com/xxxx",
                "avatar_640": "https://foo.icon.com/xxxx",
                "avatar_origin": "https://foo.icon.com/xxxx"
            },
            "status": {
                "is_frozen": false,
                "is_resigned": false,
                "is_activated": true,
                "is_exited": false,
                "is_unjoin": false
            },
            "department_ids": [
                "od-4e6ac4d14bcd5071a37a39de902c7141"
            ],
            "leader_user_id": "ou_3ghm8a2u0eftg0ff377125s5dd275z09",
            "city": "杭州",
            "country": "中国",
            "work_station": "杭州",
            "join_time": 1615381702,
            "employee_no": "e33ggbyz",
            "employee_type": 1,
            "orders": [
                {
                    "department_id": "od-4e6ac4d14bcd5071a37a39de902c7141",
                    "user_order": 100,
                    "department_order": 100,
                    "is_primary_dept": true
                }
            ],
            "custom_attrs": [
                {
                    "type": "TEXT",
                    "id": "DemoId",
                    "value": {
                        "text": "DemoText",
                        "url": "http://www.fs.cn",
                        "pc_url": "http://www.fs.cn",
                        "option_id": "edcvfrtg",
                        "option_value": "option",
                        "name": "name",
                        "picture_url": "https://xxxxxxxxxxxxxxxxxx",
                        "generic_user": {
                            "id": "9b2fabg5",
                            "type": 1
                        }
                    }
                }
            ],
            "job_level_id": "mga5oa8ayjlp9rb",
            "job_family_id": "mga5oa8ayjlp9rb",
            "dotted_line_leader_user_ids": [
                "od-4e6ac4d14bcd5071a37a39de902c7141"
            ]
        }
    }
}
```

### 事件订阅示例代码

事件订阅流程可参考：[事件订阅概述](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM)，新手入门可参考：[教程](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/develop-an-echo-bot/introduction)

**

package main

import (
	"context"
	"fmt"

larkcore "github.com/larksuite/oapi-sdk-go/v3/core"
	larkevent "github.com/larksuite/oapi-sdk-go/v3/event"
	"github.com/larksuite/oapi-sdk-go/v3/event/dispatcher"
	"github.com/larksuite/oapi-sdk-go/v3/service/contact/v3"
	larkws "github.com/larksuite/oapi-sdk-go/v3/ws"
)

// SDK 使用说明 SDK user guide：https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/preparations
func main() {
	// 注册事件 Register event
	eventHandler := dispatcher.NewEventDispatcher("", "").
		OnP2UserCreatedV3(func(ctx context.Context, event *larkcontact.P2UserCreatedV3) error {
			fmt.Printf("[ OnP2UserCreatedV3 access ], data: %s\n", larkcore.Prettify(event))
			return nil
		})

// 构建 client Build client
	cli := larkws.NewClient("YOUR_APP_ID", "YOUR_APP_SECRET",
		larkws.WithEventHandler(eventHandler),
		larkws.WithLogLevel(larkcore.LogLevelDebug),
	)

// 建立长连接 Establish persistent connection
	err := cli.Start(context.Background())

if err != nil {
		panic(err)
	}
}

# SDK 使用说明 SDK user guide：https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/python--sdk/preparations-before-development
import lark_oapi as lark

def do_p2_contact_user_created_v3(data: lark.contact.v3.P2ContactUserCreatedV3) -> None:
    print(f'[ do_p2_contact_user_created_v3 access ], data: {lark.JSON.marshal(data, indent=4)}')

# 注册事件 Register event
event_handler = lark.EventDispatcherHandler.builder("", "") \
    .register_p2_contact_user_created_v3(do_p2_contact_user_created_v3) \
    .build()

def main():
    # 构建 client Build client
    cli = lark.ws.Client("APP_ID", "APP_SECRET",
                        event_handler=event_handler, log_level=lark.LogLevel.DEBUG)
    # 建立长连接 Establish persistent connection
    cli.start()

if __name__ == "__main__":
    main()

package com.example.sample;

import com.lark.oapi.core.utils.Jsons;
import com.lark.oapi.service.contact.ContactService;
import com.lark.oapi.service.contact.v3.model.P2UserCreatedV3;
import com.lark.oapi.event.EventDispatcher;
import com.lark.oapi.ws.Client;

// SDK 使用说明 SDK user guide：https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/java-sdk-guide/preparations
public class Sample {
    // 注册事件 Register event
    private static final EventDispatcher EVENT_HANDLER = EventDispatcher.newBuilder("", "")
            .onP2UserCreatedV3(new ContactService.P2UserCreatedV3Handler() {
                @Override
                public void handle(P2UserCreatedV3 event) throws Exception {
                    System.out.printf("[ onP2UserCreatedV3 access ], data: %s\n", Jsons.DEFAULT.toJson(event.getEvent()));
                }
            })
            .build();

public static void main(String[] args) {
        // 构建 client Build client
        Client client = new Client.Builder("APP_ID", "APP_SECRET")
                .eventHandler(EVENT_HANDLER)
                .build();
        // 建立长连接 Establish persistent connection
        client.start();
    }
}

// SDK 使用说明 SDK user guide：https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/nodejs-sdk/preparation-before-development
import * as Lark from '@larksuiteoapi/node-sdk';
const baseConfig = {
    appId: 'APP_ID',
    appSecret: 'APP_SECRET'
}
// 构建 client Build client
const wsClient = new Lark.WSClient(baseConfig);
// 建立长连接 Establish persistent connection
wsClient.start({
    // 注册事件 Register event
    eventDispatcher: new Lark.EventDispatcher({}).register({
        'contact.user.created_v3': async (data) => {
            console.log(data);
        }
    })
});

package main

import (
	"context"
	"fmt"
	"net/http"

larkcore "github.com/larksuite/oapi-sdk-go/v3/core"
	"github.com/larksuite/oapi-sdk-go/v3/core/httpserverext"
	larkevent "github.com/larksuite/oapi-sdk-go/v3/event"
	"github.com/larksuite/oapi-sdk-go/v3/event/dispatcher"
	"github.com/larksuite/oapi-sdk-go/v3/service/contact/v3"
)

// SDK 使用说明 SDK user guide：https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/golang-sdk-guide/preparations
func main() {
	// 注册事件 Register event
	eventHandler := dispatcher.NewEventDispatcher("", "").
		OnP2UserCreatedV3(func(ctx context.Context, event *larkcontact.P2UserCreatedV3) error {
			fmt.Printf("[ OnP2UserCreatedV3 access ], data: %s\n", larkcore.Prettify(event))
			return nil
		})

// 创建路由处理器 Create route handler
	http.HandleFunc("/webhook/event", httpserverext.NewEventHandlerFunc(handler, larkevent.WithLogLevel(larkcore.LogLevelDebug)))

err := http.ListenAndServe(":7777", nil)

if err != nil {
		panic(err)
	}
}

# SDK 使用说明 SDK user guide：https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/python--sdk/preparations-before-development
from flask import Flask
from lark_oapi.adapter.flask import *
import lark_oapi as lark

app = Flask(__name__)

def do_p2_contact_user_created_v3(data: lark.contact.v3.P2ContactUserCreatedV3) -> None:
    print(f'[ do_p2_contact_user_created_v3 access ], data: {lark.JSON.marshal(data, indent=4)}')

# 注册事件 Register event
event_handler = lark.EventDispatcherHandler.builder("", "") \
    .register_p2_contact_user_created_v3(do_p2_contact_user_created_v3) \
    .build()

# 创建路由处理器 Create route handler
@app.route("/webhook/event", methods=["POST"])
def event():
    resp = event_handler.do(parse_req())
    return parse_resp(resp)

if __name__ == "__main__":
    app.run(port=7777)

package com.lark.oapi.sample.event;

import com.lark.oapi.core.utils.Jsons;
import com.lark.oapi.service.contact.ContactService;
import com.lark.oapi.service.contact.v3.model.P2UserCreatedV3;
import com.lark.oapi.sdk.servlet.ext.ServletAdapter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

// SDK 使用说明 SDK user guide：https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/java-sdk-guide/preparations
@RestController
public class EventController {

// 注册事件 Register event
    private static final EventDispatcher EVENT_HANDLER = EventDispatcher.newBuilder("verificationToken", "encryptKey")
            .onP2UserCreatedV3(new ContactService.P2UserCreatedV3Handler() {
                @Override
                public void handle(P2UserCreatedV3 event) throws Exception {
                    System.out.printf("[ onP2UserCreatedV3 access ], data: %s\n", Jsons.DEFAULT.toJson(event.getEvent()));
                }
            })
            .build();

// 注入 ServletAdapter 实例 Inject ServletAdapter instance
    @Autowired
    private ServletAdapter servletAdapter;

// 创建路由处理器 Create route handler
    @RequestMapping("/webhook/event")
    public void event(HttpServletRequest request, HttpServletResponse response)
            throws Throwable {
        // 回调扩展包提供的事件回调处理器 Callback handler provided by the extension package
        servletAdapter.handleEvent(request, response, EVENT_DISPATCHER);
    }
}

// SDK 使用说明 SDK user guide：https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/nodejs-sdk/preparation-before-development
import http from 'http';
import * as lark from '@larksuiteoapi/node-sdk';

// 注册事件 Register event
const eventDispatcher = new lark.EventDispatcher({
    encryptKey: '',
    verificationToken: '',
}).register({
    'contact.user.created_v3': async (data) => {
        console.log(data);
        return 'success';
    },
});

const server = http.createServer();
// 创建路由处理器 Create route handler
server.on('request', lark.adaptDefault('/webhook/event', eventDispatcher));
server.listen(3000);

