docs/en/references/feishu-notify.md
scripts/feishu-notify.ts is a CLI tool for sending notifications to Feishu (Lark) Webhook. This script is primarily used in GitHub Actions workflows to enable automatic notifications.
pnpm install
pnpm tsx scripts/feishu-notify.ts [command] [options]
| Variable | Description |
|---|---|
FEISHU_WEBHOOK_URL | Feishu Webhook URL |
FEISHU_WEBHOOK_SECRET | Feishu Webhook signing secret |
send - Send Simple NotificationSend a generic notification without business-specific logic.
pnpm tsx scripts/feishu-notify.ts send [options]
| Option | Short | Description | Required |
|---|---|---|---|
--title | -t | Card title | Yes |
--description | -d | Card description (supports markdown) | Yes |
--color | -c | Header color template | No (default: turquoise) |
Available colors: blue, wathet, turquoise, green, yellow, orange, red, carmine, violet, purple, indigo, grey, default
# Use $'...' syntax for proper newlines
pnpm tsx scripts/feishu-notify.ts send \
-t "Deployment Completed" \
-d $'**Status:** Success\n\n**Environment:** Production\n\n**Version:** v1.2.3' \
-c green
# Send an error alert (red color)
pnpm tsx scripts/feishu-notify.ts send \
-t "Error Alert" \
-d $'**Error Type:** Connection failed\n\n**Severity:** High\n\nPlease check the system status' \
-c red
Note: For proper newlines in the description, use bash's $'...' syntax. Do not use literal \n in double quotes, as it will be displayed as-is in the Feishu card.
issue - Send GitHub Issue Notificationpnpm tsx scripts/feishu-notify.ts issue [options]
| Option | Short | Description | Required |
|---|---|---|---|
--url | -u | GitHub issue URL | Yes |
--number | -n | Issue number | Yes |
--title | -t | Issue title | Yes |
--summary | -m | Issue summary | Yes |
--author | -a | Issue author | No (default: "Unknown") |
--labels | -l | Issue labels (comma-separated) | No |
pnpm tsx scripts/feishu-notify.ts issue \
-u "https://github.com/owner/repo/issues/123" \
-n "123" \
-t "Bug: Something is broken" \
-m "This is a bug report about a feature" \
-a "username" \
-l "bug,high-priority"
This script is primarily used in .github/workflows/github-issue-tracker.yml:
- name: Install dependencies
run: pnpm install
- name: Send notification
run: |
pnpm tsx scripts/feishu-notify.ts issue \
-u "${{ github.event.issue.html_url }}" \
-n "${{ github.event.issue.number }}" \
-t "${{ github.event.issue.title }}" \
-a "${{ github.event.issue.user.login }}" \
-l "${{ join(github.event.issue.labels.*.name, ',') }}" \
-m "Issue summary content"
env:
FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }}
FEISHU_WEBHOOK_SECRET: ${{ secrets.FEISHU_WEBHOOK_SECRET }}
The issue command sends an interactive card containing:
#<issue_number> - <issue_title>FEISHU_WEBHOOK_URL: Webhook addressFEISHU_WEBHOOK_SECRET: Signing secretThe script exits with a non-zero code when:
FEISHU_WEBHOOK_URL, FEISHU_WEBHOOK_SECRET)The CLI is designed to support multiple notification types. To add a new command:
program.command()