Synchronize User Data from Feishu
Feishu / LarkProfessional Edition+Introduction
The Feishu / Lark plugin synchronizes users and departments from a Feishu organization to NocoBase. It supports full synchronization on demand and incremental updates through either an HTTP callback or a Stream connection.
Before you begin
- Install and enable the Feishu / Lark and User Data Synchronization plugins.
- Create an enterprise self-built app on the Feishu Open Platform, see Authentication: Feishu / Lark.
- Grant the contact permissions and configure the contact visibility scope described below.
Contact Permissions and Visibility Scope
In the app's Permissions, enable the following permissions:
Then configure the contact permission scope (which departments and members the app can access):
- On the Development Config → Permissions page, click Configure on the right of the "Accessible data scope" column of a contact permission (enabling a contact permission also redirects here automatically).
- Select the departments and members the app can access. For the first setup, choosing All members is recommended to verify the pipeline, then narrow it down as needed.
- Click OK to save.
The contact permission scope and the "app availability scope" (who can use the app) are two independent settings — do not confuse them; only the contact permission scope affects data synchronization. API permissions decide which fields the app can read, while the contact permission scope decides which departments and users — both must be configured. The synchronization scope follows the permission scope; run a full synchronization again after changing it. Event subscription does not replace read permissions: on every event NocoBase still calls the Feishu API to fetch the latest user or department data.
Add a Feishu Sync Source
Go to Users & Permissions → Sync and add a source of type Feishu / Lark:
Save and enable the source, then click Sync to perform the first full synchronization.
Choosing the Event Receiving Mode
Stream Mode
Stream mode keeps a persistent WebSocket connection initiated by the NocoBase server. No public callback URL, token or encrypt key is required.
- Select Stream mode in NocoBase, save and enable the source.
- On the open platform under Events & Callbacks, switch the receiving mode to Long connection (WebSocket) and subscribe to the contact events.
The connection starts automatically when the source is enabled (with automatic reconnection) and is refreshed or closed when the source is updated, disabled or deleted.
Stream mode requires no public inbound address and no reverse proxy, which suits intranet deployments. Search the application logs for Feishu stream client to check the connection status.
HTTP Callback
HTTP callback mode receives Feishu events at a NocoBase callback URL.
- Select HTTP callback in NocoBase and configure the Verification Token and optionally the Encrypt Key — at least one is required.
- Save the source and copy the Event callback URL shown in the UI.
- On the open platform under Events & Callbacks → Event configuration, set the receiving mode to push events to the server, paste the URL and subscribe to the contact events.
The callback URL must be reachable by Feishu (HTTPS in production). With an Encrypt Key configured, callback payloads are encrypted.
Without a Verification Token or Encrypt Key, callback requests are rejected (401). After a source is switched to Stream mode, the HTTP callback endpoint is closed (403).
Supported Incremental Events
Both modes support the following Feishu contact events:
Users with the Root role are never deleted by synchronization.
Synchronized Fields
Department fields
User fields
Department Owners
Department owners (leaders) from the department data are synchronized as department owners in NocoBase: a user can own multiple departments, and an owned department is not necessarily the user's main department. Only departments within the visibility scope participate. Owners removed on the Feishu side are removed on the next synchronization; manually changed owners in NocoBase may be overwritten by the next synchronization.
Other Feishu user fields such as avatar, job title and employee number are not synchronized currently.
Troubleshooting
- Empty sync results or missing departments: check the contact permissions and whether the department is within the contact permission scope (see above for configuration).
- Empty nicknames: enable Obtaining user basic information (
contact:user.base:readonly) and run a full synchronization again. - Users skipped: check whether the user has a value for the configured identifier field and whether it matches the authenticator's choice.
- HTTP callback returns 401: no Verification Token or Encrypt Key configured, or token verification failed; 403: the source has been switched to Stream mode.
redirect_urior callback URL errors: make sure the URL configured on the open platform matches the one shown in NocoBase exactly, including any sub-path prefix (APP_PUBLIC_PATH).- Sync task fails with a Feishu API rate limit error: wait until the limit is lifted and run the synchronization again manually.

