Feishu Invoice Approval
Build and run a confirmed Feishu invoice approval bot
Haorui Wu
@wuhaorui
Install
$ openclaw skills install @wuhaorui/automate-feishu-invoice-approvalAutomate Feishu Invoice Approval
Build a reusable Python service that turns invoice images sent to a Feishu bot into uploader-confirmed expense approvals.
Core workflow
-
Choose a new or empty target directory. Do not overwrite an existing project.
-
Run
python3 <skill-directory>/scripts/scaffold.py --target <target-directory>. -
Read references/setup.md before configuring a first deployment or changing an approval definition.
-
Copy
.env.exampleto.envandconfig/approval_mapping.example.jsontoconfig/approval_mapping.json. -
Fill the buyer name, buyer tax ID, approval code, expense option IDs, and approval widget IDs. Never put an app secret in
.envor the mapping file. -
Configure the Feishu application credential with
scripts/setup-lark.sh. -
Run the generated project's tests and validation:
PYTHONPATH=src python3 -m unittest discover -s tests -v PYTHONPATH=src python3 -m invoice_approval_bot.cli validate -
Start with
BOT_DRY_RUN=true. Send representative invoices and verify extraction, buyer-header rejection, individual-seller equipment rejection, zero or masked tax rejection, tax-rate arithmetic, category selection, reason generation, confirmation-card callbacks, and duplicate handling. -
Set
BOT_AUTO_SUBMIT=trueandBOT_DRY_RUN=falseonly when the user explicitly authorizes real approval creation. -
Run
scripts/run.shunder the user's preferred supervisor. Read references/operations.md for status meanings and incident checks.
Safety invariants
- Limit file reads and writes to the Skill bundle and the user-selected target project. Shell access is required to run the scaffolder, tests, validation,
codex, andlark-cli; environment access is limited to the variables declared in frontmatter and the generated project's.env. - Reject an invoice before confirmation when either the normalized buyer name or normalized buyer tax ID differs from the configured values. Tell the uploader which field failed.
- Reject equipment purchases from a seller name that appears to be an individual. Treat repair, maintenance, installation, consulting, design, development, rental, testing, training, and other explicit service items as services even when their names mention equipment.
- Reject invoices when the total or line-item tax is zero, masked with asterisks, missing, unparsable, inconsistent with
amount × tax ratebeyond a 0.02 currency-unit rounding tolerance, or inconsistent between line totals and the invoice tax total. Return every detected risk reason to the uploader. - Never create a real approval until the original uploader clicks Submit on the confirmation card.
- Accept card actions only from the uploader and only for the matching card and source message.
- Keep dry-run enabled during initial setup, approval-form changes, and callback changes.
- Preserve SQLite idempotency and invoice-fingerprint duplicate protection.
- Do not publish or log
.env, app secrets, approval credentials, real invoice images, extracted invoice JSON, SQLite databases, open IDs, or organization-specific approval/widget IDs. - Do not invent approval widget or radio-option IDs. Obtain them from the target approval definition.
Customization
- Edit the JSON Schema enum in
config/invoice-output.schema.jsonand the matchingexpense_type_optionsobject together when changing expense categories. - Keep mapping values on supported paths such as
invoice.expense_category_value,invoice.approval_summary,invoice.total_amount_number, andapproval_file.attachment_code. - Update or add unit tests whenever changing mappings, normalization, card actions, or submission state transitions.
- Keep the bundled confirmation gate unless the user explicitly requests a different approval policy and understands the risk.
Bundled resources
scripts/scaffold.pycopies a clean, reusable project template.assets/template/contains the Python service, tests, schema, and safe example configuration.references/setup.mdcovers Feishu application and approval mapping setup.references/operations.mdcovers dry-run promotion, records, statuses, and troubleshooting.
Top skills in this category
LNBits Wallet wtih QR Code
@jamestsetsekasManage LNbits Lightning Wallet (Balance, Pay, Invoice)
Zero Trust
@doonotSecurity-first behavioral guidelines for cautious agent operation. Use this skill for ALL operations involving external resources, installations, credentials, or actions with external effects. Triggers on - any URL/link interaction, package installations, API key handling, sending emails/messages, social media posts, financial transactions, or any action that could expose data or have irreversible effects.
moltrade
@ai-chen2050Operate the Moltrade trading bot (config, backtest, test-mode runs, Nostr signal broadcast, exchange adapters, strategy integration) in OpenClaw.
Polymarket Trader
@drakec48Build and analyze a BTC 1h Up/Down trading strategy anchored to Binance BTCUSDT, applying edge thresholds, regime filters, and detailed trade validation.
Finnhub Pro
@lsj210001Finnhub 美股金融数据 CLI。实时报价、公司档案、新闻、分析师推荐、内部人交易、盈利日历、基本面财务、同行比较。Python 脚本封装,免费层 60 次/分钟。Use when: 查股价、查公司信息、看最新新闻、了解内部人是否在买卖、查看近期财报日期。NOT for: K线数据、目标价、情绪分析(需付费层)。