$ cat node-template.py
L
Lark Get Tasklist
// Fetches a single Lark tasklist (board) by its ID. Returns the tasklist name, owner, and members. Re-execute to refresh.
Input
Integration
template.py
1import os2import sys3import json4import traceback56try:7 import requests8except ImportError:9 import subprocess10 subprocess.check_call([sys.executable, "-m", "pip", "install", "requests"])11 import requests1213LARK_BASE_URL = "https://open.larksuite.com/open-apis"141516def get_lark_token():17 # Prefer user token (OAuth — sees user's resources)18 user_token = os.getenv("LARK_USER_TOKEN")19 if user_token:20 return user_token2122 # Fallback to tenant token (app-level — limited visibility)23 app_id = os.getenv("LARK_APP_ID")24 app_secret = os.getenv("LARK_APP_SECRET")25 if not app_id or not app_secret:26 raise ValueError(27 "Lark is not connected. Add LARK_APP_ID and LARK_APP_SECRET as workspace secrets, "28 "then connect via workspace settings to authorize user access."29 )30 resp = requests.post(31 f"{LARK_BASE_URL}/auth/v3/tenant_access_token/internal",32 json={"app_id": app_id, "app_secret": app_secret},33 )34 resp.raise_for_status()35 data = resp.json()36 if data.get("code") != 0:37 raise ValueError(f"Lark auth failed: {data.get('msg')}")38 return data["tenant_access_token"]394041def lark_request(method, path, **kwargs):42 token = get_lark_token()43 headers = {44 "Authorization": f"Bearer {token}",45 "Content-Type": "application/json; charset=utf-8",46 }47 resp = requests.request(48 method, f"{LARK_BASE_URL}{path}", headers=headers, **kwargs49 )50 resp.raise_for_status()51 data = resp.json()52 if data.get("code") != 0:53 raise ValueError(f"Lark API error ({data['code']}): {data.get('msg')}")54 return data555657def main():58 try:59 inputs = json.loads(sys.stdin.read()).get("inputs", {})6061 tasklist_guid = inputs.get("tasklistGuid")62 if not tasklist_guid:63 raise ValueError("tasklistGuid is required")6465 result = lark_request("GET", f"/task/v2/tasklists/{tasklist_guid}")6667 tasklist = result.get("data", {}).get("tasklist", {})6869 output = {70 "tasklist": tasklist,71 "name": tasklist.get("name", ""),72 "owner": tasklist.get("owner", {}),73 "members": tasklist.get("members", []),74 "url": tasklist.get("url", ""),75 "success": True,76 }77 print(json.dumps(output, indent=2, ensure_ascii=False))7879 except Exception as e:80 error_output = {81 "error": str(e),82 "errorType": type(e).__name__,83 "traceback": traceback.format_exc(),84 }85 print(json.dumps(error_output), file=sys.stderr)86 sys.exit(1)878889if __name__ == "__main__":90 main()$ git log --oneline
v1.1.0
HEAD
2026-05-07v1.0.02026-04-09