UNPKG

@warriorteam/zalo-webhook-types

Version:

TypeScript types for Zalo Personal webhook events from automation-web

146 lines 3.8 kB
/** * Interaction Event Types * * Events related to user interactions with messages (5 total). * Includes typing, seen, delivered, reaction, and undo events. */ import { ZaloWebhookEvent } from './base'; import { ZaloThreadType, ZaloReactionIcon } from '../enums'; /** * Typing event * Triggered when user is typing a message */ export interface ZaloTypingEvent extends ZaloWebhookEvent { eventType: "typing"; data: { uid: string; ts: string; isPC: number; gid?: string; threadId: string; threadType: ZaloThreadType; fromId: string; fromName: string; isTyping: boolean; }; } /** * Seen messages event * Triggered when messages are marked as seen/read */ export interface ZaloSeenMessagesEvent extends ZaloWebhookEvent { eventType: "seen-messages"; data: { messages: Array<{ msgId: string; realMsgId: string; idTo?: string; groupId?: string; seenUids?: string[]; threadId: string; threadType: ZaloThreadType; seenBy: string[]; seenAt: number; }>; }; } /** * Delivered messages event * Triggered when messages are delivered to recipients */ export interface ZaloDeliveredMessagesEvent extends ZaloWebhookEvent { eventType: "delivered-messages"; data: { messages: Array<{ msgId: string; realMsgId: string; seen: number; deliveredUids: string[]; seenUids: string[]; mSTs: number; groupId?: string; threadId: string; threadType: ZaloThreadType; deliveredTo: string[]; deliveredAt: number; }>; }; } /** * Reaction event * Triggered when user reacts to a message */ export interface ZaloReactionEvent extends ZaloWebhookEvent { eventType: "reaction"; data: { msgId: string; uidFrom: string; dName: string; ts: string; content: { rIcon: ZaloReactionIcon; rType: number; }; realMsgId: string; groupId?: string; threadId: string; threadType: ZaloThreadType; fromId: string; fromName: string; reaction: string; timestamp: number; }; } /** * Undo event * Triggered when user recalls/deletes a sent message */ export interface ZaloUndoEvent extends ZaloWebhookEvent { eventType: "undo"; data: { msgId: string; cliMsgId: string; uidFrom: string; idTo: string; dName: string; ts: string; realMsgId: string; groupId?: string; threadId: string; threadType: ZaloThreadType; fromId: string; fromName: string; undoMsgId: string; timestamp: number; }; } /** * Union of all interaction events */ export type ZaloInteractionEvent = ZaloTypingEvent | ZaloSeenMessagesEvent | ZaloDeliveredMessagesEvent | ZaloReactionEvent | ZaloUndoEvent; /** * Interaction events by thread type */ export type ZaloUserInteractionEvent = ZaloInteractionEvent & { data: { threadType: "user"; }; }; export type ZaloGroupInteractionEvent = ZaloInteractionEvent & { data: { threadType: "group"; }; }; /** * Message status events (seen + delivered) */ export type ZaloMessageStatusEvent = ZaloSeenMessagesEvent | ZaloDeliveredMessagesEvent; /** * Message modification events (reaction + undo) */ export type ZaloMessageModificationEvent = ZaloReactionEvent | ZaloUndoEvent; /** * Real-time interaction events (typing) */ export type ZaloRealTimeInteractionEvent = ZaloTypingEvent; //# sourceMappingURL=interaction-events.d.ts.map