UNPKG

@warriorteam/zalo-webhook-types

Version:

TypeScript types for Zalo Personal webhook events from automation-web

271 lines 6.35 kB
/** * Base Types for Zalo Webhook Events * * Contains fundamental interfaces and types used across all webhook events. */ import { ZaloMessageCategory, ZaloThreadType } from "../enums"; /** * Base webhook event interface - all events extend this */ export interface ZaloWebhookEvent { /** Type of the webhook event */ eventType: string; /** Session ID of the user */ sessionId: string; /** UUID of the user */ userUuid: string; /** Timestamp when event occurred (milliseconds) */ timestamp: number; /** Event-specific data */ data: any; } /** * Base message event data - all message events extend this */ export interface ZaloMessageEventData { /** Action ID from SDK */ actionId: string; /** Unique message ID */ msgId: string; /** Client message ID */ cliMsgId: string; /** Message type from SDK */ msgType: string; /** User ID of sender */ uidFrom: string; /** Target ID (user or group) */ idTo: string; /** Display name of sender */ dName: string; /** Timestamp from SDK */ ts: string; /** Message status (1=success) */ status: number; /** Message content (varies by type) */ content: string | object; /** Notification settings */ notify?: string; /** Time to live */ ttl?: number; /** User ID (duplicate of uidFrom) */ userId?: string; /** User identification number */ uin?: string; /** Real message ID */ realMsgId?: string; /** Top out parameter */ topOut?: string; /** Top out timeout */ topOutTimeOut?: string; /** Top out impression timeout */ topOutImprTimeOut?: string; /** Thread ID (user or group) */ threadId: string; /** Type of thread */ threadType: ZaloThreadType; /** Whether message is from self */ isSelf: boolean; /** Message type (same as msgType) */ messageType: string; /** Message category */ messageCategory: ZaloMessageCategory; /** Whether message has attachment */ hasAttachment: boolean; /** Message mentions */ mentions?: ZaloMessageMention[]; /** Quoted/replied message */ quote?: ZaloMessageQuote; /** Property extensions */ propertyExt?: ZaloPropertyExtension; /** Parameter extensions */ paramsExt?: ZaloParametersExtension; } /** * Base message event interface */ export interface ZaloMessageEvent extends ZaloWebhookEvent { data: ZaloMessageEventData; } /** * Message mention information */ export interface ZaloMessageMention { /** User ID being mentioned */ uid: string; /** Display name of mentioned user */ name: string; /** Start position in text */ start: number; /** Length of mention text */ length: number; } /** * Message quote/reply information */ export interface ZaloMessageQuote { /** ID of quoted message */ msgId: string; /** User ID of quoted message author */ uidFrom: string; /** Content of quoted message */ content: string; /** Display name of quoted message author */ dName: string; } /** * Property extension information */ export interface ZaloPropertyExtension { /** Color property */ color: number; /** Size property */ size: number; /** Type property */ type: number; /** Sub type property */ subType: number; /** Additional extension data */ ext?: string; } /** * Parameters extension information */ export interface ZaloParametersExtension { /** Count of unread messages */ countUnread: number; /** Container type */ containType: number; /** Platform type */ platformType: number; } /** * Generic properties object for attachments */ export interface ZaloAttachmentProperties { /** Sub type of attachment */ subType: number; /** Color information */ color: number; /** Size category */ size: number; /** Type category */ type: number; } /** * Link preview information */ export interface ZaloLinkPreview { /** Full URL */ url: string; /** Page title */ title?: string; /** Page description */ description?: string; /** Preview image URL */ image?: string; /** Domain name */ domain?: string; } /** * Thread information */ export interface ZaloThreadInfo { /** Thread ID */ threadId: string; /** Thread type */ threadType: ZaloThreadType; /** Thread name (for groups) */ threadName?: string; /** Thread avatar URL */ threadAvatar?: string; } /** * User information */ export interface ZaloUserInfo { /** User ID */ userId: string; /** Display name */ displayName: string; /** Avatar URL */ avatarUrl?: string; /** Username */ username?: string; } /** * Error information */ export interface ZaloErrorInfo { /** Error code */ errorCode: string; /** Error message */ errorMessage: string; /** Additional error details */ errorDetails?: any; /** Error timestamp */ timestamp: number; } /** * File information */ export interface ZaloFileInfo { /** File name */ fileName: string; /** File size in bytes */ fileSize: number; /** File type/MIME type */ fileType: string; /** File checksum */ checksum: string; /** File URL */ url: string; } /** * Media dimensions */ export interface ZaloMediaDimensions { /** Width in pixels */ width: number; /** Height in pixels */ height: number; /** Aspect ratio */ aspectRatio?: number; } /** * Duration information */ export interface ZaloDuration { /** Duration in milliseconds */ duration: number; /** Duration in seconds */ durationSeconds?: number; /** Formatted duration string */ formatted?: string; } /** * Location coordinates */ export interface ZaloCoordinates { /** Latitude */ latitude: number; /** Longitude */ longitude: number; /** Accuracy in meters */ accuracy?: number; } /** * Reaction information */ export interface ZaloReactionInfo { /** Reaction icon ID */ rIcon: number; /** Reaction type */ rType: number; /** User who reacted */ userId: string; /** User display name */ userName: string; /** Reaction timestamp */ timestamp: number; } //# sourceMappingURL=base.d.ts.map