| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- // 飞书消息类型
- export type FeishuMsgType = 'text' | 'post' | 'interactive';
- // 接收者 ID 类型
- export type ReceiveIdType = 'open_id' | 'user_id' | 'union_id' | 'email' | 'chat_id';
- // 文本消息内容
- export interface TextContent {
- text: string;
- }
- // 富文本消息内容
- export interface PostContent {
- zh_cn?: {
- title?: string;
- content: Array<Array<{
- tag: 'text' | 'a' | 'at';
- text?: string;
- href?: string;
- user_id?: string;
- }>>;
- };
- }
- // 发送消息请求体(Webhook 方式)
- export interface SendMessageRequest {
- webhook_url: string;
- msg_type: FeishuMsgType;
- content: TextContent | PostContent | any;
- }
- // 发送消息到个人请求体(API 方式)
- export interface SendToUserRequest {
- receive_id_type: ReceiveIdType;
- receive_id: string;
- msg_type: FeishuMsgType;
- content: any;
- }
- // 批量发送消息到多人请求体
- export interface SendToMultipleUsersRequest {
- receive_id_type: ReceiveIdType;
- receive_ids: string[];
- msg_type: FeishuMsgType;
- content: any;
- }
- // 飞书 API 响应
- export interface FeishuResponse {
- code: number;
- msg: string;
- data?: any;
- }
|