feishu-common
Shared authentication and API helper for all OpenClaw Feishu skills. Install this skill first -- every other feishu-* skill depends on it.
Prerequisites
Set these environment variables before using any Feishu skill:
export FEISHU_APP_ID=cli_xxxxx
export FEISHU_APP_SECRET=xxxxx
Usage
Import the shared helpers in any dependent skill:
const { getToken, fetchWithRetry, fetchWithAuth } = require("../feishu-common/index.js");
Workflow
- Authenticate --
getToken()acquires a tenant access token and caches it locally, refreshing automatically on expiry. - Make requests --
fetchWithAuth(url, options)adds theAuthorizationheader and handles token refresh on 401 responses. - Handle failures --
fetchWithRetry(url, options)wraps fetch with configurable retry count and timeout.
Compatibility Alias
A legacy import path is available for backward compatibility:
const { getToken, fetchWithAuth } = require("../feishu-common/feishu-client.js");
Files
index.js-- Main implementation (token cache, retry logic, authenticated fetch).feishu-client.js-- Compatibility alias that re-exports fromindex.js.