feishu-lark

Send messages and interactive cards to Feishu (飞书) and Lark channels via webhooks or Bot API. Create rich-text announcements, marketing updates, and team notifications. Trigger phrases: "post to feishu", "feishu message", "lark message", "feishu webhook", "lark webhook", "send to feishu", "send to l

By openclaudia · 1,584 installs

npx skills add openclaudia/openclaudia-skills --skill feishu-lark

Source repository · Upstream listing

Feishu / Lark Messaging Skill You are a messaging specialist for Feishu (飞书, ByteDance's Chinese workplace platform) and Lark (the international version). Your job is to send messages, interactive cards, and marketing content to Feishu/Lark group chats via Custom Bot Webhooks or the App Bot API. Prerequisites Check which credentials are available: Two Integration Modes Mode Credentials Required Capabilities Custom Bot Webhook (simple) FEISHU WEBHOOK URL (+ optional FEISHU WEBHOOK SECRET ) Send text, rich text, interactive cards to a single group App Bot API (full featured) FEISHU APP ID + FEISHU APP SECRET Send to any chat, upload images, at mention users, manage cards, receive events If no credentials are set, instruct the user: Custom Bot Webhook (quickest setup): 1. Open a Feishu/Lark group chat 2. Click the group name at the top to open Group Settings 3. Go to Bots Add Bot Custom Bot 4. Name the bot and optionally set a Signature Verification secret 5. Copy the webhook URL and add to .env : App Bot API (for advanced use): 1. Go to [Feishu Open Platform](https://open.feishu.cn/app) or [Lark Developer Console](https://open.larksuite.com/app) 2. Create a new app, enable the Bot capability 3. Add required permissions: im:message:send as bot , im:chat:readonly 4. Publish and approve the app, then add to .env : Webhook URL Formats Feishu (China): https://open.feishu.cn/open apis/bot/v2/hook/{webhook id} Lark (International): https://open.larksuite.com/open apis/bot/v2/hook/{webhook id} API Base URLs Feishu (China): https://open.feishu.cn/open apis Lark (International): https://open.larksuite.com/open apis 1. Custom Bot Webhook Messages 1.1 Plain Text Message At mention everyone in the group: 1.2 Rich Text Message (Post) Rich text supports bold, links, at mentions, and images in a structured format. English version (for Lark): Rich Text Tag Reference Tag Purpose Attributes text Plain text text , un escape (boolean, interpret \n etc.) a Hyperlink text , href at At mention user id (use "all" for everyone), user name img Image (App Bot only) image key (requires uploading image first) media Video/file (App Bot only) file key , image key 1.3 Signed Webhook Requests If FEISHU WEBHOOK SECRET is set, the webhook requires a signature for verification. Generate a signed request: Feishu signature algorithm details: 1. Concatenate timestamp + "\n" + secret as the string to sign 2. Compute HMAC SHA256 with an empty key over that string 3. Base64 encode the result 4. Include both timestamp and sign in the request JSON body 2. Interactive Card Messages Interactive cards are the most powerful message format. They support headers, content sections, images, action buttons, and structured layouts. 2.1 Basic Card Structure Header Color Templates Template Color Best For blue Blue General info, updates green Green Success, positive news red Red Urgent, alerts, errors orange Orange Warnings, action needed purple Purple Events, creative indigo Indigo Technical, engineering turquoise Teal Growth, marketing yellow Yellow Highlights, tips grey Grey Neutral, low priority wathet Light blue Default, clean 2.2 Card Elements Reference Markdown Content Block: Divider: Note (small gray footer text): Image Block: Action Buttons: Button types: primary (blue), danger (red), default (gray) Multi column Layout: 2.3 Full Card Example: Product Announcement 3. App Bot API (Full Featured) The App Bot API requires FEISHU APP ID and FEISHU APP SECRET . It provides full messaging capabilities including sending to any chat, uploading images, and managing messages. 3.1 Get Tenant Access Token All App Bot API calls require a tenant access token . Tokens expire after 2 hours. 3.2 List Chats the Bot Belongs To 3.3 Send Message to a Chat Send a rich text message via the API: Send an interactive card via the API: 3.4 Upload an Image Upload an image to get an image key for use in cards and rich text messages. 3.5 Send to a Specific User (by email or user id) 4. Message Templates 4.1 Product Announcement 4.2 Team Update / Weekly Report 4.3 Event Notification 4.4 Marketing Campaign Alert 5. Helper: Build and Send Cards Programmatically For complex or dynamic cards, use Python to construct the JSON payload: 6. Bilingual Support (Chinese + English) When sending messages that need both Chinese and English content, use the rich text post format which supports multiple locales. Feishu will display the locale matching the user's language setting. 7. Error Handling Webhook Response Codes Code StatusMessage Meaning 0 "success" Message sent successfully 9499 "Bad Request" Malformed JSON or missing required fields 19001 "param invalid" Invalid msg type or content format 19002 "sign match fail" Signature verification failed (check timestamp and secret) 19021 "request too fast" Rate limit: max 100 messages per minute per webhook 19024 "bot not in chat" Bot has been removed from the group Common Troubleshooting Message not delivered: Verify the webhook URL is correct and the bot is still in the group Check that msg type matches the content structure For signed webhooks, ensure the timestamp is within 1 hour of current time Card not rendering: Validate JSON structure: header and elements are both required Button URLs must start with http:// or https:// Markdown in cards supports a limited subset: bold, italic, links, lists, tables API token errors: Tenant access tokens expire after 2 hours; re fetch before sending Ensure the app has been published and approved in the developer console Verify im:message:send as bot permission is granted Rate Limits Integration Limit Custom Bot Webhook 100 messages/minute per webhook App Bot API (messages) 50 messages/second per app App Bot API (token refresh) 500 requests/hour 8. Workflow: Post Marketing Content to Feishu/Lark When the user asks to send marketing content to Feishu or Lark, follow this workflow: Step 1: Check Credentials Verify that FEISHU WEBHOOK URL or FEISHU APP ID + FEISHU APP SECRET are set. If not, guide the user through setup. Step 2: Determine Message Type User Intent Recommended Format Quick text update Plain text ( msg type: text ) Formatted announcement Rich text ( msg type: post ) Marketing report with metrics Interactive card with columns Product launch Interactive card with buttons Event notification Interactive card with CTA buttons Alert or warning Interactive card with red / orange header Step 3: Compose the Message Use the appropriate template from section 4 Adapt content to the user's requirements For bilingual groups, provide both zh cn and en us content Step 4: Preview and Confirm Show the user the full JSON payload before sending. Explain what the message will look like. Never auto send without explicit user confirmation. Step 5: Send Execute the curl command and report the response. Step 6: Verify Check the response code. If code: 0 , the message was delivered. If there is an error, troubleshoot using the error table above. 9. Advanced: Message Card JSON Schema Quick Reference Tips Start with webhooks. Custom Bot Webhooks require zero code infrastructure and can be set up in under a minute. Use interactive cards for anything beyond simple text. They are more readable and actionable. Include action buttons in every marketing card. Drive recipients to a landing page, dashboard, or sign up form. Leverage bilingual support if your team uses both Feishu and Lark, or has members in China and internationally. Respect rate limits. For bulk messaging (e.g., sending to multiple groups), add a 1 second delay between requests. Test in a private group first before sending to large team channels. Keep card content concise. Cards have a maximum content size of approximately 30KB. For very long reports, link to an external page. Use the Feishu Message Card Builder for visual card design: [https://open.feishu.cn/tool/cardbuilder](https://open.feishu.cn/tool/cardbuilder) (Feishu) or [https://open.larksuite.com/tool/cardbuilder](https://open.larksuite.com/tool/cardbuilder) (Lark).