pywayne-lark-custom-bot
Feishu/Lark Custom Bot API wrapper for sending messages via webhook. Use when users need to send text messages, images, rich text posts, interactive cards, or share chat content to Feishu/Lark channels. Supports image upload from files or OpenCV/numpy images, signature verification for security, and @mention functionality. Ideal for one-way notifications, alerts, scheduled tasks, and simple push scenarios without message listening or two-way interaction requirements.
What this skill does
# Pywayne Lark Custom Bot - Webhook Message Sender
## Overview
`LarkCustomBot` is a webhook-based Feishu (Lark) bot wrapper designed for **one-way message pushing**. It's ideal for scenarios where you only need to send messages to Feishu groups without listening for incoming messages or managing complex interactions.
**Key Characteristics**:
- Lightweight, simple webhook-based architecture
- No event subscription or listening capabilities
- Perfect for alerts, notifications, scheduled tasks
- Supports signature verification for security
**When to Use LarkCustomBot**:
- Push-only scenarios (notifications, alerts, reports)
- Simple scheduled tasks sending updates
- Quick setup without event subscription configuration
- Don't need message replies, reactions, or chat management
**When to Use LarkBot Instead**:
- Need to listen and reply to messages
- Require message lifecycle management (recall, edit, reactions)
- Need chat management (members, admins, announcements)
- Interactive features like button callbacks
## Installation
```bash
pip install pywayne
```
## Quick Start
```python
from pywayne.lark_custom_bot import LarkCustomBot
# Initialize bot with webhook
bot = LarkCustomBot(
webhook="https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxx"
)
# Send simple text message
bot.send_text("Hello, Feishu!")
# Send text with @all mention
bot.send_text("Important announcement!", mention_all=True)
```
## LarkCustomBot Class
### Constructor
```python
bot = LarkCustomBot(
webhook: str, # Required: Webhook URL from Feishu group bot settings
secret: str = '', # Optional: Signing secret for request verification
bot_app_id: str = '', # Optional: App ID for image upload authentication
bot_secret: str = '' # Optional: App secret for image upload authentication
)
```
**Parameters**:
- `webhook`: Webhook URL obtained from Feishu group custom bot settings
- `secret`: Signing secret for signature verification (enhances security)
- `bot_app_id`: Required for `upload_image()` and `upload_image_from_cv2()`
- `bot_secret`: Required for `upload_image()` and `upload_image_from_cv2()`
**Note**: Image upload requires app credentials (`bot_app_id` and `bot_secret`) because it uses Feishu's OpenAPI authentication, not webhook.
## Core Methods
### send_text - Send Text Message
Send plain text message with optional @all mention.
```python
bot.send_text(text: str, mention_all: bool = False) -> None
```
**Parameters**:
- `text`: Message text content
- `mention_all`: Whether to @all users in the group (default `False`)
**Examples**:
```python
# Simple text
bot.send_text("Daily backup completed successfully")
# With @all mention
bot.send_text("System maintenance at 23:00 tonight", mention_all=True)
# Multi-line text
bot.send_text("""
Deployment completed:
- API: v1.2.3
- Frontend: v2.4.5
- Database migration: done
""")
# With HTML-like formatting (supported in text messages)
bot.send_text("<b>Bold text</b> and <i>italic text</i>")
```
### send_post - Send Rich Text Post
Send rich text message with structured content including text, links, @mentions, and images.
```python
bot.send_post(
content: List[List[Dict]], # 2D list of content elements
title: Optional[str] = None # Optional post title
) -> None
```
**Parameters**:
- `content`: 2D list structure where:
- Outer list = multiple lines
- Inner list = multiple elements in the same line
- `title`: Post title displayed at the top
**Content Structure**:
```python
content = [
[element1, element2], # Line 1 with 2 elements
[element3], # Line 2 with 1 element
[element4, element5], # Line 3 with 2 elements
]
```
**Basic Example**:
```python
from pywayne.lark_custom_bot import (
LarkCustomBot,
create_text_content,
create_link_content,
create_at_content,
create_image_content
)
bot = LarkCustomBot(
webhook="https://open.feishu.cn/open-apis/bot/v2/hook/xxx",
bot_app_id="cli_xxx",
bot_secret="sec_xxx"
)
# Upload image first
image_key = bot.upload_image("/tmp/report.png")
# Construct post content
content = [
# Line 1: Title text
[create_text_content("Daily Report", unescape=False)],
# Line 2: Link
[create_link_content(href="https://dashboard.example.com", text="View Dashboard")],
# Line 3: @mention
[create_at_content(user_id="all", user_name="Everyone")],
# Line 4: Image
[create_image_content(image_key=image_key, width=400, height=300)],
# Line 5: Multiple elements in one line
[
create_text_content("Status: "),
create_text_content("✅ Completed", unescape=True)
]
]
bot.send_post(content, title="Daily Operations Report")
```
### send_image - Send Image Message
Send image message using image key.
```python
bot.send_image(image_key: str) -> None
```
**Note**: Must upload image first using `upload_image()` or `upload_image_from_cv2()`.
**Example**:
```python
# Upload and send local image
image_key = bot.upload_image("/path/to/chart.png")
bot.send_image(image_key)
# Upload from OpenCV image
import cv2
import numpy as np
img = cv2.imread("/path/to/image.jpg")
# Process image...
image_key = bot.upload_image_from_cv2(img)
bot.send_image(image_key)
```
### send_interactive - Send Interactive Card
Send interactive card message with buttons, forms, or other interactive elements.
```python
bot.send_interactive(card: Dict) -> None
```
**Parameters**:
- `card`: Interactive card JSON structure following Feishu card schema
**Example: Simple Notification Card**:
```python
card = {
"config": {"wide_screen_mode": True},
"header": {
"title": {"tag": "plain_text", "content": "Approval Required"},
"template": "red"
},
"elements": [
{
"tag": "markdown",
"content": "**Ticket #1234** is waiting for approval"
},
{
"tag": "action",
"actions": [
{
"tag": "button",
"text": {"tag": "plain_text", "content": "View Details"},
"type": "primary",
"url": "https://example.com/ticket/1234"
}
]
}
]
}
bot.send_interactive(card)
```
**Example: Status Card with Multiple Elements**:
```python
card = {
"header": {
"title": {"tag": "plain_text", "content": "Build Status"},
"template": "blue"
},
"elements": [
{
"tag": "div",
"text": {"tag": "lark_md", "content": "**Build #456** completed"}
},
{
"tag": "hr"
},
{
"tag": "div",
"fields": [
{"is_short": True, "text": {"tag": "lark_md", "content": "**Duration**\n3m 42s"}},
{"is_short": True, "text": {"tag": "lark_md", "content": "**Status**\n✅ Success"}}
]
}
]
}
bot.send_interactive(card)
```
### send_share_chat - Share Chat
Share a chat group as a card.
```python
bot.send_share_chat(share_chat_id: str) -> None
```
**Example**:
```python
# Share a group chat
bot.send_share_chat("oc_a1b2c3d4e5f6g7h8")
```
## Image Upload Methods
### upload_image - Upload from File Path
Upload local image file to Feishu and get image key.
```python
image_key = bot.upload_image(file_path: str) -> str
```
**Parameters**:
- `file_path`: Local path to image file
**Returns**:
- `str`: Image key if successful, empty string if failed
**Example**:
```python
# Upload and send
image_key = bot.upload_image("/tmp/screenshot.png")
if image_key:
bot.send_image(image_key)
else:
print("Image upload failed")
```
**Requirements**:
- Must set `bot_app_id` and `bot_secret` in constructor
- File must exist and not be empty
- Supported formats: JPEG, PNG, GIF, etc.
### upload_image_from_cv2 - Upload from OpenCV Image
Upload image directly from OpenCV/numpy array.
```python
image_key = bRelated in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.