UNPKG

redai-automation-web-sdk

Version:

TypeScript SDK for RedAI Automation Web API - Zalo Personal automation, messaging, advanced sticker search, and bulk operations. 100% compatible with automation-web backend. v1.8.1: Updated GroupInfo interface to match backend controller with complete gro

638 lines 12.7 kB
/** * Thread Type Enum - chuẩn theo zalo-personal SDK */ export declare enum ThreadType { User = 0, Group = 1 } /** * Text Style Enum - chuẩn theo zalo-personal SDK */ export declare enum TextStyle { Bold = "b", Italic = "i", Underline = "u", StrikeThrough = "s", Red = "c_db342e", Orange = "c_f27806", Yellow = "c_f7b503", Green = "c_15a85f", Small = "f_13", Big = "f_18", UnorderedList = "lst_1", OrderedList = "lst_2", Indent = "ind_$" } /** * Urgency Enum - chuẩn theo zalo-personal SDK */ export declare enum Urgency { Default = 0, Important = 1, Urgent = 2 } /** * Message Type Enum - chuẩn theo automation-web */ export declare enum MessageType { WebChat = "webchat", Photo = "chat.photo", Video = "chat.video", File = "chat.file", Sticker = "chat.sticker", Link = "chat.link", Location = "chat.location", Contact = "chat.contact", Todo = "chat.todo", GroupPoll = "group.poll" } /** * Zalo Reactions Enum - chuẩn theo automation-web */ export declare enum ZaloReactions { HEART = "/-heart", LIKE = "/-strong", HAHA = ":>", WOW = ":o", CRY = ":-((", ANGRY = ":-h", KISS = ":-*", TEARS_OF_JOY = ":')", SHIT = "/-shit", ROSE = "/-rose", BROKEN_HEART = "/-break", DISLIKE = "/-weak", LOVE = ";xx", CONFUSED = ";-/", WINK = ";-)", FADE = "/-fade", SUN = "/-li", BIRTHDAY = "/-bd", BOMB = "/-bome", OK = "/-ok", PEACE = "/-v", THANKS = "/-thanks", PUNCH = "/-punch", SHARE = "/-share", PRAY = "_()_", NO = "/-no", BAD = "/-bad", LOVE_YOU = "/-loveu", SAD = "--b", VERY_SAD = ":((", COOL = "x-)", NERD = "8-)", BIG_SMILE = ";-d", SUNGLASSES = "b-)", NEUTRAL = ":--|", SAD_FACE = "p-(", BYE = ":-bye", SLEEPY = "|-)", WIPE = ":wipe", DIG = ":-dig", ANGUISH = "&-(", HANDCLAP = ":handclap", ANGRY_FACE = ">-|", F_CHAIR = ":-f", L_CHAIR = ":-l", R_CHAIR = ":-r", SILENT = ";-x", SURPRISE = ":-o", EMBARRASSED = ";-s", AFRAID = ";-a", SAD2 = ":-<", BIG_LAUGH = ":))", RICH = "$-)", BEER = "/-beer" } /** * Style interface - chuẩn theo automation-web StyleDto */ export interface Style { /** * Vị trí bắt đầu của style */ start: number; /** * Độ dài của text được style */ len: number; /** * Loại style */ st: TextStyle; } /** * Mention interface - chuẩn theo automation-web MentionDto */ export interface Mention { /** * Vị trí của mention trong text */ pos: number; /** * User ID được mention */ uid: string; /** * Độ dài của mention text */ len: number; } /** * Attachment Content interface - chuẩn theo automation-web AttachmentContentDto */ export interface AttachmentContent { /** * Tiêu đề attachment */ title?: string; /** * Mô tả attachment */ description?: string; /** * Link href của attachment */ href?: string; /** * Link thumbnail */ thumb?: string; /** * Số lượng children */ childnumber?: number; /** * Action type */ action?: string; /** * Parameters JSON string */ params?: string; /** * Content type */ type?: string; } /** * Property Extension interface - chuẩn theo automation-web PropertyExtDto */ export interface PropertyExt { /** * Màu sắc */ color?: number; /** * Kích thước */ size?: number; /** * Loại */ type?: number; /** * Loại phụ */ subType?: number; /** * Extension data */ ext?: string; } /** * Send Message Quote interface - chuẩn theo automation-web SendMessageQuoteDto */ export interface SendMessageQuote { /** * Nội dung tin nhắn được quote */ content: string | AttachmentContent | Record<string, any>; /** * Loại tin nhắn được quote */ msgType: MessageType; /** * Property extension của tin nhắn được quote */ propertyExt?: PropertyExt; /** * User ID người gửi tin nhắn được quote */ uidFrom: string; /** * Message ID được quote */ msgId: string; /** * Client Message ID */ cliMsgId: string; /** * Timestamp (string format) */ ts: string; /** * Time to live (seconds) */ ttl: number; } /** * Attachment Metadata interface - chuẩn theo automation-web AttachmentMetadataDto */ export interface AttachmentMetadata { /** * Kích thước file (bytes) */ totalSize: number; /** * Chiều rộng (cho ảnh/video) */ width?: number; /** * Chiều cao (cho ảnh/video) */ height?: number; } /** * Attachment interface - chuẩn theo automation-web AttachmentDto */ export interface Attachment { /** * URL để tải file từ internet */ url?: string; /** * Tên file (bắt buộc khi dùng URL hoặc Buffer) */ filename?: string; /** * HTTP headers cho download (khi dùng URL) */ headers?: Record<string, string>; /** * Đường dẫn file local */ filePath?: string; /** * Base64 encoded file data */ base64Data?: string; /** * Metadata của file (bắt buộc khi dùng base64Data) */ metadata?: AttachmentMetadata; } /** * DTO để gửi tin nhắn - chuẩn theo automation-web SendMessageDto */ export interface SendMessageRequest { /** * Nội dung tin nhắn */ msg: string; /** * ID thread (user hoặc group) */ threadId: string; /** * Loại thread */ type: ThreadType; /** * Session ID của Zalo Personal */ sessionId: string; /** * Text styles - định dạng văn bản */ styles?: Style[]; /** * Mentions trong tin nhắn */ mentions?: Mention[]; /** * Quote message - tin nhắn được trả lời */ quote?: SendMessageQuote; /** * Danh sách file đính kèm */ attachments?: Attachment[]; /** * Mức độ ưu tiên tin nhắn */ urgency?: Urgency; /** * Time to live - thời gian tự hủy tin nhắn (milliseconds) */ ttl?: number; } /** * DTO để gửi sticker - chuẩn theo automation-web SendStickerDto */ export interface SendStickerRequest { /** * Session ID của Zalo Personal */ sessionId: string; /** * ID thread (user hoặc group) */ threadId: string; /** * Loại thread */ type: ThreadType; /** * ID của sticker */ stickerId: string; } /** * DTO để gửi voice message - chuẩn theo automation-web SendVoiceDto */ export interface SendVoiceRequest { /** * Session ID của Zalo Personal */ sessionId: string; /** * ID thread (user hoặc group) */ threadId: string; /** * Loại thread */ type: ThreadType; /** * URL của file voice */ fileUrl: string; /** * Thời lượng voice (giây) */ duration?: number; } /** * DTO để gửi video message - chuẩn theo automation-web SendVideoDto */ export interface SendVideoRequest { /** * Session ID của Zalo Personal */ sessionId: string; /** * ID thread (user hoặc group) */ threadId: string; /** * Loại thread */ type: ThreadType; /** * URL của video */ videoUrl: string; /** * Thời lượng video (giây) */ duration?: number; /** * Chiều rộng video */ width?: number; /** * Chiều cao video */ height?: number; } /** * DTO để gửi link message - chuẩn theo automation-web SendLinkDto */ export interface SendLinkRequest { /** * Session ID của Zalo Personal */ sessionId: string; /** * ID thread (user hoặc group) */ threadId: string; /** * Loại thread */ type: ThreadType; /** * Link cần gửi */ link: string; /** * Tin nhắn kèm theo link */ msg?: string; /** * Time to live (giây) */ ttl?: number; } /** * DTO để gửi contact card - chuẩn theo automation-web SendCardDto */ export interface SendCardRequest { /** * Session ID của Zalo Personal */ sessionId: string; /** * ID thread (user hoặc group) */ threadId: string; /** * Loại thread */ type: ThreadType; /** * User ID của người cần chia sẻ thông tin */ userId: string; /** * Số điện thoại của người cần chia sẻ thông tin */ phoneNumber?: string; } /** * DTO để chuyển tiếp tin nhắn - chuẩn theo automation-web ForwardMessageDto */ export interface ForwardMessageRequest { /** * Session ID của Zalo Personal */ sessionId: string; /** * Tin nhắn cần chuyển tiếp */ message: any; /** * Danh sách thread IDs đích */ threadIds: string[]; /** * Loại thread đích */ type: ThreadType; /** * Reference message (optional) */ reference?: any; } /** * DTO để xóa tin nhắn - chuẩn theo automation-web DeleteMessageDto */ export interface DeleteMessageRequest { /** * Session ID của Zalo Personal */ sessionId: string; /** * ID tin nhắn cần xóa */ messageId: string; /** * ID thread (user hoặc group) */ threadId: string; /** * Loại thread */ type: ThreadType; } /** * DTO để thu hồi tin nhắn (undo) - chuẩn theo automation-web UndoMessageDto */ export interface UndoMessageRequest { /** * Session ID của Zalo Personal */ sessionId: string; /** * ID tin nhắn cần thu hồi */ msgId: string; /** * Client message ID */ cliMsgId: string; /** * ID thread (user hoặc group) */ threadId: string; /** * Loại thread */ type: ThreadType; } /** * DTO để thêm reaction - chuẩn theo automation-web AddReactionDto */ export interface AddReactionRequest { /** * Session ID của Zalo Personal */ sessionId: string; /** * Loại reaction (sử dụng ZaloReactions enum) */ reaction: ZaloReactions; /** * Message ID (global message ID) */ msgId: string; /** * Client message ID */ cliMsgId: string; /** * ID thread (user hoặc group) */ threadId: string; /** * Loại thread */ type: ThreadType; } /** * Send Message Result từ Zalo SDK */ export interface SendMessageResult { msgId: number; } /** * Response DTO cho send message - chuẩn theo automation-web SendMessageResponseDto */ export interface SendMessageResponse { /** * Thông tin tin nhắn đã gửi (null nếu không có tin nhắn text) */ message: SendMessageResult | null; /** * Thông tin attachments đã gửi */ attachment: SendMessageResult[]; /** * Trạng thái thành công */ success?: boolean; /** * Thông báo lỗi nếu có */ error?: string; } /** * Response types từ zalo-personal SDK - import từ automation-web */ export interface SendStickerResponse { success: boolean; messageId?: string; error?: string; } export interface SendVoiceResponse { success: boolean; messageId?: string; error?: string; } export type SendVideoResponse = { msgId: number; }; export type SendLinkResponse = { msgId: string; }; export type SendCardResponse = { msgId: number; }; export type Success = { clientId: string; msgId: string; }; export type Failed = { clientId: string; errorCode: number; errorMessage: string; }; export interface ForwardMessageResponse { success: boolean; messageIds?: string[]; error?: string; } export type DeleteMessageResponse = { status: number; }; export type UndoResponse = { status: number; }; export interface AddReactionResponse { success: boolean; error?: string; } //# sourceMappingURL=messaging.type.d.ts.map