interface ChatEventTypes {
    chat.active_chat: ChatModel;
    chat.live_location_end: {
        chat: WAJS.whatsapp.Wid;
        id: WAJS.whatsapp.Wid;
        seq: number;
    };
    chat.live_location_start: {
        accuracy?: number;
        chat: WAJS.whatsapp.Wid;
        degrees?: number;
        id: WAJS.whatsapp.Wid;
        lat: number;
        lng: number;
        msgId: MsgKey;
        shareDuration: number;
        speed?: number;
    };
    chat.live_location_update: {
        accuracy?: number;
        comment: string;
        degrees?: number;
        elapsed: number;
        id: WAJS.whatsapp.Wid;
        lastUpdated: number;
        lat: number;
        lng: number;
        speed?: number;
    };
    chat.msg_ack_change: {
        ack: number;
        chat: WAJS.whatsapp.Wid;
        ids: MsgKey[];
        sender?: WAJS.whatsapp.Wid;
    };
    chat.msg_edited: {
        chat: WAJS.whatsapp.Wid;
        id: string;
        msg: MsgModel;
    };
    chat.msg_revoke: {
        author?: WAJS.whatsapp.Wid;
        from: WAJS.whatsapp.Wid;
        id: MsgKey;
        refId: MsgKey;
        to: WAJS.whatsapp.Wid;
        type: "revoke" | "sender_revoke" | "admin_revoke";
    };
    chat.new_message: MsgModel;
    chat.new_reaction: {
        id: MsgKey;
        msgId: MsgKey;
        orphan: number;
        orphanReason: any;
        reactionText: string;
        read: boolean;
        sender: WAJS.whatsapp.Wid;
        timestamp: number;
    };
    chat.poll_response: {
        chatId: WAJS.whatsapp.Wid;
        msgId: MsgKey;
        selectedOptions: number[];
        sender: WAJS.whatsapp.Wid;
        timestamp: number;
    };
    chat.presence_change: {
        id: WAJS.whatsapp.Wid;
        isContact?: boolean;
        isGroup: boolean;
        isOnline: boolean;
        isUser: boolean;
        participants?: {
            id: string;
            shortName: string;
            state: string;
        }[];
        shortName: string;
        state: string;
        t: number;
    };
    chat.update_label: {
        chat: ChatModel;
        ids: string[];
        labels: Label[];
        type: "add" | "remove";
    };
}

Properties

chat.active_chat: ChatModel

Triggered when change the active chat

WPP.on('chat.active_chat', (chat) => {
// Your code
});
chat.live_location_end: {
    chat: WAJS.whatsapp.Wid;
    id: WAJS.whatsapp.Wid;
    seq: number;
}

Temporary unsuported by WhatsApp Web Multi-Device

chat.live_location_start: {
    accuracy?: number;
    chat: WAJS.whatsapp.Wid;
    degrees?: number;
    id: WAJS.whatsapp.Wid;
    lat: number;
    lng: number;
    msgId: MsgKey;
    shareDuration: number;
    speed?: number;
}
chat.live_location_update: {
    accuracy?: number;
    comment: string;
    degrees?: number;
    elapsed: number;
    id: WAJS.whatsapp.Wid;
    lastUpdated: number;
    lat: number;
    lng: number;
    speed?: number;
}

Temporary unsuported by WhatsApp Web Multi-Device

chat.msg_ack_change: {
    ack: number;
    chat: WAJS.whatsapp.Wid;
    ids: MsgKey[];
    sender?: WAJS.whatsapp.Wid;
}

Type declaration

  • ack: number
  • chat: WAJS.whatsapp.Wid

    The chat that sended the messeage

  • ids: MsgKey[]

    Message id of revoke event

  • Optionalsender?: WAJS.whatsapp.Wid

    Who sended the ack, only for groups, broadcast and status

chat.msg_edited: {
    chat: WAJS.whatsapp.Wid;
    id: string;
    msg: MsgModel;
}

On Message edit

chat.msg_revoke: {
    author?: WAJS.whatsapp.Wid;
    from: WAJS.whatsapp.Wid;
    id: MsgKey;
    refId: MsgKey;
    to: WAJS.whatsapp.Wid;
    type: "revoke" | "sender_revoke" | "admin_revoke";
}

Type declaration

chat.new_message: MsgModel

Triggered when new message is received

WPP.on('chat.new_message', (msg) => {
// Your code
});
chat.new_reaction: {
    id: MsgKey;
    msgId: MsgKey;
    orphan: number;
    orphanReason: any;
    reactionText: string;
    read: boolean;
    sender: WAJS.whatsapp.Wid;
    timestamp: number;
}

Triggered when a new reaction is received

Type declaration

  • id: MsgKey

    Reaction ID

  • msgId: MsgKey

    Message ID that received the reaction

  • orphan: number
  • orphanReason: any
  • reactionText: string

    The reaction emoji or empty if removed

  • read: boolean
  • sender: WAJS.whatsapp.Wid
  • timestamp: number
WPP.on('chat.new_reaction', (msg) => {
// Your code
});
chat.poll_response: {
    chatId: WAJS.whatsapp.Wid;
    msgId: MsgKey;
    selectedOptions: number[];
    sender: WAJS.whatsapp.Wid;
    timestamp: number;
}

On Poll response

chat.presence_change: {
    id: WAJS.whatsapp.Wid;
    isContact?: boolean;
    isGroup: boolean;
    isOnline: boolean;
    isUser: boolean;
    participants?: {
        id: string;
        shortName: string;
        state: string;
    }[];
    shortName: string;
    state: string;
    t: number;
}

On presence change

chat.update_label: {
    chat: ChatModel;
    ids: string[];
    labels: Label[];
    type: "add" | "remove";
}

On Labels update