Log daily department attendance to Lark Base with Lark
Go to WorkflowDescription
Quick overview
This workflow runs daily (or manually) to pull attendance logs for all users in a Lark department via the Lark Open Platform APIs, then writes each user’s first check-in and last check-out into a Lark Base (Bitable) table in batches.
How it works
Runs on a daily schedule at 23:30 or starts manually for testing.
Requests a Lark tenant access token using your Lark app ID and app secret.
Fetches the list of users in the configured Lark department.
Calculates the current day’s start and end timestamps in the configured timezone and prepares one query per user.
Queries Lark Attendance for each user’s check-in/out flows within the day window.
Consolidates results per user per day, keeping the first check-in and last check-out and deriving on-time/late and early-out statuses.
Batch-creates records in the target Lark Base (Bitable) table with the attendance details.
Setup
Create a Lark app with access to Contact, Attendance, and Bitable APIs, then fill in app_id and app_secret in Template Config.
Set your department_id (open_department_id) in Template Config and adjust departmentPageSize if needed.
Create or choose a Lark Base (Bitable) app and table, then set bitable_AppToken and bitable_TableId in Template Config.
Ensure the target Bitable table has the required fields (Employee, Check In/Out Time, comments, location, Employee Code, and the two status single-select fields with the specified values).
Optionally adjust timezone, bitableBatchSize, and the check-in/check-out cutoff times in Template Config to match your attendance rules.