Feishu
Use the Feishu source to replicate Approval, Bitable/Base, Attendance, Contact, and EHR employee-roster data from a customer-managed Feishu tenant into Daspire.
Feishu and Lark appear as separate source entries in Daspire because customers manage them in different Open Platform portals and tenants. They share the same connector implementation under the hood.
Supported modules
| Module | Status | Output |
|---|---|---|
| Approval | Supported | Raw approval instance payloads, approval instance base records, approval field key/value rows, task details, and timeline details |
| Bitable/Base | Supported | Bitable record metadata plus raw fields JSON |
| Attendance | Supported | Check-in flow records for all visible users by default, with optional employee ID filters |
| Contact | Supported | Users under the root department by default, with optional department filters |
EHR employee roster (Native)
The opt-in EHR employee roster module exposes ehr_employees. Use a
customer-owned Feishu custom app with tenant administrator approval and the
Read employee roster (ehr:employee:readonly) permission. The endpoint uses
an app's tenant access token; a user access token or Contact permission alone
is insufficient. Source check probes the EHR endpoint so missing permission
fails before a sync is scheduled.
Select ehr in Modules. Approval codes are needed only when Approval is also
selected. Existing approval sources retain their selected streams. This module
is implemented in the Native Feishu image; the historical Airbyte Feishu/Lark
images do not gain roster support from this release.
The source reads every page of GET /open-apis/ehr/v1/employees with view=full
and user_id_type=user_id, without status, employee type or date filters. All
statuses returned by the app's authorized scope are retained, including leavers.
An empty result can mean an empty permission scope and must be checked against
HR's expected population before accepting the data.
| Output | Meaning |
|---|---|
user_id | Stable tenant employee key when assigned; pending/canceled onboarding rows may have null |
employee_no | HR employee number; do not substitute it for the stable key |
name, en_name | HR names |
department_id, manager, job, job_level | Organization and role references as returned by EHR |
status, employee_type | Original numeric status and type; HR owns the business mapping |
hire_date, conversion_date, last_day | Original HR dates |
system_fields, custom_fields | Original standard and custom fields for downstream mapping |
extracted_at | UTC extraction time shared by all rows in that scan |
Refresh and downstream use
Use full refresh, initially daily through Daspire's existing schedule. EHR's
start_time/end_time constrain hire dates, not record modification times, so
using them as incremental cursors would miss department and termination changes.
Every subsequent refresh scans existing employees again. No change-data-capture
or deletion event is implied by this API.
Publish a complete successful snapshot to the reporting model. user_id is a
stable join key for employees who have one. Pending and canceled onboarding rows
can have null user_id; they are retained without an invented identity. The
stream therefore declares no universal primary key. Do not collapse these rows
by null ID, name or employee number. With an append destination, select the latest successful scan before
counting employees; do not count all historical rows. Preserve the last complete
snapshot after a failed scan. An absent employee must be reconciled with HR and
app visibility before treating the absence as a deletion. Validate the initial
snapshot and a repeat refresh against HR totals and sampled department/status
values before switching an existing dashboard.
The connector retries transient HTTP/network failures with a bounded budget; permission failures, malformed pages and repeated pagination tokens fail the run. Employee payloads and app credentials must stay out of operational logs. Use Daspire's existing failed-run visibility and retry workflow; no separate Airflow script is required.
See the Feishu EHR API for the provider contract. HR and the dashboard owner must confirm custom-field mappings and status labels before switching the reporting model.
Directory: department tree, leaders and enterprise email (Native 1.3.0)
These opt-in modules are available for Feishu in Native 1.3.0. An existing EHR Source keeps its saved module list and does not gain these streams; create a new Source for them.
| Module / stream | Provider APIs | Contents |
|---|---|---|
ehr_department_tree | Filter departments, batch get departments | Every department visible to the app, including departments with no directly assigned employees, with parent, names, leaders, status and hierarchy outcome |
ehr_users | Batch get users | Profiles of every EHR roster user and every department leader, with separate enterprise_email and personal email |
ehr_departments | Batch get departments | Unchanged 1.2.0 lookup: only the department IDs referenced by EHR rows |
Choose EHR Department Tree for the complete organization. EHR
Departments keeps its original lookup behavior for configurations that already
select it; it does not list unstaffed or empty departments. Select EHR
Employee Roster (ehr) to also collect the employees themselves. Use a new
Daspire Source and Connection for these modules, reusing the approved Feishu
custom app and credentials; keep an existing roster Source and Connection as
configured.
How the tree is collected
On every refresh the connector:
- reads the root department (
0) and then lists the children of every department, page by page (100 per page), from the root down; - reads all EHR roster pages and looks up every referenced department that the listing did not reach (for example a disabled department or one outside the app's visibility);
- looks up each missing parent until every chain reaches the root or an unresolvable ancestor.
Department IDs are open_department_id values (od-...), the type EHR uses in
system_fields.department_id. The root is the provider's 0. When EHR refers
to the root by its od- ID, a single-ID lookup must return the root before the
alias is accepted; the alias is then listed in the root row's
ehr_department_id_aliases instead of producing a second root row.
Field (ehr_department_tree) | Meaning |
|---|---|
department_id, department_id_type | Open department ID; type is always open_department_id |
parent_department_id | Parent open department ID; 0 for top-level departments, null for the root |
is_root | True only for the root (0) |
name, name_i18n | Default display name and the original multilingual names (zh_cn, en_us, ja_jp) |
leaders | [{leader_id, leader_id_type: "open_id", leader_type}]; leader_type 1 is the main leader, 2 a deputy |
enabled_status, has_child, department_count, order_weight | Provider status and structure fields as returned |
collection_source | tree (listed from the root), ehr_reference (referenced by EHR, not listed) or parent_reference (an ancestor of another row) |
collection_status | returned, inaccessible (provider denied the row) or not_returned (provider omitted it) |
in_active_tree, is_deleted, deletion_status_source | Listed departments are active (is_deleted: false, source active_tree_listing). Every other returned department is checked with Contact's department status (contact_department_status); null when the provider returned no row |
hierarchy_status, unresolved_ancestor_id | resolved_to_root, or unresolved with the first ancestor that could not be read |
children_enumerated | True when the department's children were listed (or the provider reports it has none); false when the provider refused to list an inaccessible department's children, or the department was found only by reference |
ehr_referenced, ehr_department_id_aliases | Whether EHR rows reference the department, and the root's EHR aliases |
unavailable_fields | Optional fields the provider did not return (for example the root has no enabled_status) |
raw_payload, extracted_at | Original provider row and the UTC extraction time shared by the scan |
Feishu's department lookup still returns deleted departments, with
enabled_status: true and their last parent, and the listing APIs omit them.
Employees (often leavers) can still reference such a department, so use
is_deleted, not enabled_status, to tell historical departments from active
ones. An inaccessible or not_returned row is a collection outcome, not
evidence that a department was deleted. Employees are never dropped and no relationship
is invented: an employee whose department cannot be read still joins to an
explicit row.
Users and enterprise email
ehr_users covers the users referenced by EHR (user_id) and every department
leader in the tree. Leaders arrive as open_id; the connector resolves them with
the Contact batch API using user_id_type=open_id, which returns the tenant
user_id in the same profile. No identifier is converted locally.
Field (ehr_users) | Meaning |
|---|---|
user_key | Stable key: user_id:<user_id>, or open_id:<open_id> when the provider returned no user_id |
user_id, open_id | Tenant user ID and app-scoped open ID, each with an explicit *_type |
reference_sources | ehr_roster, department_leader, or both |
lookup_status | returned, or not_returned when the provider omitted the profile |
enterprise_email | Enterprise mailbox only; null when Feishu returns none |
email | Personal email, kept separate |
name, en_name, department_ids, status, employee_no, employee_type, job_title | Provider profile fields; status is the original object |
raw_payload, extracted_at | Original profile and extraction time |
enterprise_email is never filled from personal email, an EHR email field or
a generated address. A null value may mean missing field permission or no
mailbox; reconcile it with HR. A not_returned profile does not mean deletion or
resignation. Pending and canceled onboarding rows without a user_id stay in
ehr_employees and are not looked up.
Joins for downstream models
| From | To | Join |
|---|---|---|
ehr_employees.system_fields.department_id | ehr_department_tree | department_id, or the root row when the value is in ehr_department_id_aliases |
ehr_department_tree.parent_department_id | ehr_department_tree.department_id | Repeat until is_root to rebuild the hierarchy |
ehr_department_tree.leaders[].leader_id | ehr_users.open_id | Department leaders |
ehr_employees.user_id | ehr_users.user_id | Enterprise email and profile for each employee |
Business rules such as employee-status interpretation, salary rules and daily reporting metrics belong in the downstream models, not in the connector.
Permissions
The custom app needs EHR roster access (ehr:employee:readonly) for all of
these modules, because EHR references are collected even if ehr_employees is
not selected. In addition:
- Department tree: List departments (
directory:department:list), View department information (directory:department:read), and the department field scopes for ID (directory:department.external_id:read), name (directory:department.name:read), parent ID (directory:department.parent_id:read), leaders (directory:department.leader:read), status (directory:department.status:read), has-child (directory:department.has_child:read), member counts (directory:department.count:read) and order (directory:department.order_weight:read). - Deletion status of departments outside the active tree uses Contact's get
department API, covered by
contact:contact.base:readonlybelow. - Users: Get basic information in contacts (
contact:contact.base:readonly), user ID (contact:user.employee_id:readonly) and Obtain user's employment information (contact:user.employee:readonly) forenterprise_email. Personalemailneeds its own field scope; request it only if needed. ehr_usersalso lists the tree to find leaders, so it needs the department tree permissions.ehr_departments(lookup only) needsdirectory:department:readwith the name and parent ID field scopes.
Name, parent ID and leaders are required. Without a field scope Feishu omits
the field rather than reporting an error, so a returned department without one
of them fails the run with directory_permission_missing, naming the field. Other
withheld fields are listed in unavailable_fields.
Visibility follows the app's contact range (通讯录权限范围). Set it to
All members to collect the whole organization. The root department must be
readable: otherwise check and sync fail with directory_scope_incomplete
instead of returning a partial organization. Below the root, a department the
app cannot read is reported as inaccessible, and children_enumerated: false
marks a subtree the provider would not list. Source check probes the root department, one child listing and
the selected lookups; a successful token alone is not accepted as permission
evidence.
Snapshot semantics
All directory streams use full refresh. Each run reads the whole roster and tree again; there is no change cursor. A tree or user stream assembles its complete snapshot before emitting any record. A permission error, malformed response, cycle, duplicate department, repeated page token or exhausted retry fails the run, so a failed run never replaces the last accepted snapshot with a partial one. Transient HTTP failures use the bounded retry budget. Errors are sanitized: they name the provider contract (for example a missing field permission), never tenant data or credentials.
These modules are qualified for Feishu only, not for Lark or the historical Airbyte images.
Authentication modes
Current public setup uses BYOA / custom app credentials. Daspire does not currently provide a public Feishu store app that customers can install from the Feishu marketplace for this source.
BYOA / custom app credentials
Use this mode when the customer creates and owns the Feishu Open Platform app.
Required fields:
| Field | Description |
|---|---|
| App ID | Feishu Open Platform app ID |
| App Secret | Feishu Open Platform app secret |
To get these values:
- Sign in to the Feishu Open Platform.
- Create or open a customer-owned custom app for the Feishu tenant.
- Open the app credentials page and copy the App ID and App Secret. Feishu documents this as the custom-app
tenant_access_tokenflow: self-built app tenant access token. - Grant the app the permissions required by the modules you plan to sync.
- Publish or enable the custom app for the tenant after the tenant administrator approves the permissions.
- Paste the App ID and App Secret into Daspire.
Daspire exchanges the app ID and app secret for a tenant access token with:
POST https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal
The app secret is stored as an encrypted connector secret.
Store app / marketplace-ready
This mode is reserved for a Daspire-managed Feishu store app or private marketplace deployment. Do not choose it for normal customer-created custom apps.
Daspire does not currently expose a self-service Feishu marketplace app installation flow for this source. A usable store-app setup requires:
- A Daspire-owned Feishu store app that has passed the Feishu marketplace or private deployment review.
- A tenant administrator installing that app.
- A Daspire installation callback that receives the tenant key.
- Daspire-managed app ticket, app access token, and tenant access token lifecycle automation.
Feishu explains the difference between custom apps and store apps in self-built apps and store apps. The token exchange for store apps is documented in store app tenant access token.
Reserved fields:
| Field | Description |
|---|---|
| Tenant Key | Tenant key received by Daspire from a completed store app installation callback |
| App Access Token | App-level token generated by the Daspire-managed store app token flow |
| Tenant Access Token | Optional pre-minted tenant token from a Daspire-managed store app deployment |
Customers cannot obtain these values from a BYOA/custom app in the Feishu developer console. Use BYOA unless Daspire has explicitly provided store-app installation details for your tenant.
Required permissions
Grant only the permissions required by the modules you enable.
| Module | Required Open Platform access |
|---|---|
| Approval | Read approval definitions, query approval instances, and read approval instance details |
| Bitable/Base | Read Bitable apps, tables, views, records, and automatic record metadata |
| Attendance | Export attendance/check-in data for the configured employee ID type. Default all-user sync also needs enough Contact access to enumerate visible users. |
| Contact | Read basic contact information and the user fields you intend to sync |
| EHR employee roster | Read employee roster (ehr:employee:readonly) |
| EHR directory (tree, users, lookups) | See Permissions under the directory modules |
If the customer uses a custom app, the app must be published or enabled for the tenant after permissions are approved.
Set up Feishu in Daspire
- Select Feishu from the source catalog.
- Enter a source name.
- Choose the authentication mode.
- For BYOA, enter the Feishu App ID and App Secret.
- Select Approval, Bitable/Base, Attendance, Contact, EHR Employee Roster, or any combination. The EHR directory modules (EHR Department Tree, EHR Users / Enterprise Email, EHR Departments) are also listed here.
- For Approval, enter one or more approval codes and a rolling lookback window in days.
- For Bitable/Base, enter the app token, table ID, and optional view ID.
- For Attendance, optionally enter employee IDs or employee numbers to filter the sync. Leave empty to scan all users visible to the app, and choose the matching ID type.
- For Contact, optionally enter department IDs to filter the sync. Leave empty to scan from the root department, and choose the matching department and user ID types.
- Save and test the source.
Notes
- Approval sync uses an incremental cursor where Feishu supports time-window filtering. A rolling lookback is used to catch updates when the upstream API does not expose a reliable updated timestamp.
- Bitable/Base records preserve table fields as raw JSON. Daspire does not hardcode table-specific field names.
- Attendance and Contact are opt-in modules. When selected, they default to scanning all users and departments visible to the app; filters can narrow the scope.
- Contact enrichment is available as a connector helper for future stream enrichment. The Contact module itself emits user rows only when selected.