talkyzap-wapp-api 1.0.19 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## 3.18.8 (2025-11-10)
1
+ ## 3.19.3 (2025-11-26)
2
2
 
3
3
 
4
4
 
@@ -17,10 +17,10 @@ import { MsgKey } from '../../whatsapp';
17
17
  import { LinkPreviewOptions, SendMessageOptions, SendMessageReturn } from '..';
18
18
  export type EditMessageOptions = SendMessageOptions & LinkPreviewOptions;
19
19
  /**
20
- * Send a text message
20
+ * Edit a message previously sent.
21
21
  *
22
22
  * @example
23
- * WPP.chat.editMessage('[number]@c.us', 'New text for message', {
23
+ * WPP.chat.editMessage('true_[number]@c.us_[msgId]', 'New text for message', {
24
24
  * linkPreview: true,
25
25
  * mentionedJidList: ['5521985232287@c.us']
26
26
  * });
@@ -57,6 +57,7 @@ export { pinMsg, unpinMsg } from './pinMsg';
57
57
  export { LinkPreviewOptions, prepareLinkPreview } from './prepareLinkPreview';
58
58
  export { MessageButtonsOptions, prepareMessageButtons, } from './prepareMessageButtons';
59
59
  export { prepareRawMessage } from './prepareRawMessage';
60
+ export { ButtonReplyOptions, replyToButtonMessage, } from './replyToButtonMessage';
60
61
  export { requestPhoneNumber } from './requestPhoneNumber';
61
62
  export { sendCatalogMessage } from './sendCatalogMessage';
62
63
  export { OrderItems, OrderMessageOptions, sendChargeMessage, } from './sendChargeMessage';
@@ -0,0 +1,44 @@
1
+ /*!
2
+ * Copyright 2024 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export interface ButtonReplyOptions {
17
+ /**
18
+ * The index of the button to reply to (0-based)
19
+ * For example: 0 for first button, 1 for second button
20
+ */
21
+ buttonIndex: number;
22
+ }
23
+ /**
24
+ * Reply to a button message by clicking a specific button
25
+ *
26
+ * @example
27
+ * ```javascript
28
+ * // Reply to the first button (Yes)
29
+ * await WPP.chat.replyToButtonMessage(
30
+ * '[number]@c.us',
31
+ * 'messageId',
32
+ * { buttonIndex: 0 }
33
+ * );
34
+ *
35
+ * // Reply to the second button (No)
36
+ * await WPP.chat.replyToButtonMessage(
37
+ * '[number]@c.us',
38
+ * 'messageId',
39
+ * { buttonIndex: 1 }
40
+ * );
41
+ * ```
42
+ * @category Message
43
+ */
44
+ export declare function replyToButtonMessage(chatId: any, messageId: string, options: ButtonReplyOptions): Promise<any>;
@@ -13,6 +13,20 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ export interface BuildConstants {
17
+ VERSION_STR: string;
18
+ VERSION_BASE: string;
19
+ VERSION_PRIMARY: string;
20
+ VERSION_SECONDARY: string;
21
+ VERSION_TERTIARY: string;
22
+ WINDOWS_BUILD: string | null;
23
+ PARSED: {
24
+ PRIMARY: number;
25
+ SECONDARY: number;
26
+ TERTIARY: number;
27
+ };
28
+ [key: string]: any;
29
+ }
16
30
  /**
17
31
  * Get the WhatsApp Web build constants
18
32
  * Retrieves the internal WAWebBuildConstants module from WhatsApp source
@@ -25,7 +39,7 @@
25
39
  * console.log('Windows Build:', buildConstants.WINDOWS_BUILD);
26
40
  * ```
27
41
  *
28
- * @returns {object|null} Object containing version constants or null if not available
42
+ * @returns {BuildConstants|null} Object containing version constants or null if not available
29
43
  * - VERSION_STR: Full version string (e.g., "2.3000.1234567")
30
44
  * - VERSION_BASE: Base version (e.g., "2.3000.1234567")
31
45
  * - VERSION_PRIMARY: Primary version number
@@ -34,4 +48,19 @@
34
48
  * - WINDOWS_BUILD: Windows build number (if applicable)
35
49
  * - And other build-related constants
36
50
  */
37
- export declare function getBuildConstants(): string | null;
51
+ export declare function getBuildConstants(): BuildConstants | null;
52
+ /**
53
+ * Check if the current WhatsApp version is greater than or equal to a specified version
54
+ *
55
+ * @example
56
+ * ```javascript
57
+ * // Check if version is >= 2.3000.1030110621
58
+ * if (WPP.conn.isWhatsAppVersionGTE('2.3000.1030110621')) {
59
+ * console.log('Using new API');
60
+ * }
61
+ * ```
62
+ *
63
+ * @param version - Version string to compare against (e.g., "2.3000.1029")
64
+ * @returns {boolean} True if current version is >= specified version
65
+ */
66
+ export declare function isWhatsAppVersionGTE(version: string): boolean;
@@ -16,7 +16,7 @@
16
16
  export { changeEnviromentDevice } from './changeEnviromentDevice';
17
17
  export { genLinkDeviceCodeForPhoneNumber } from './genLinkDeviceCodeForPhoneNumber';
18
18
  export { getAuthCode } from './getAuthCode';
19
- export { getBuildConstants } from './getBuildConstants';
19
+ export { BuildConstants, getBuildConstants, isWhatsAppVersionGTE, } from './getBuildConstants';
20
20
  export { getHistorySyncProgress, HistorySyncProgress, } from './getHistorySyncProgress';
21
21
  export { getMigrationState, MigrationState } from './getMigrationState';
22
22
  export { getMyDeviceId } from './getMyDeviceId';
@@ -21,13 +21,17 @@ import { ContactModel } from '../../whatsapp';
21
21
  * ```javascript
22
22
  * await WPP.contact.save('5533999999999@c.us', 'John', {
23
23
  * surname: 'Doe',
24
- * syncAdressBook: true,
24
+ * syncAddressBook: true,
25
25
  * });
26
26
  * ```
27
27
  *
28
28
  * @category Contact
29
29
  */
30
- export declare function save(contactId: string | any, name: string, options?: {
30
+ export declare function save(contactId: string | any, firstName: string, options?: {
31
+ /** @deprecated Use lastName instead */
31
32
  surname?: string;
33
+ /** @deprecated Use syncAddressBook instead, this one with typo was updated */
32
34
  syncAdressBook?: boolean;
35
+ lastName?: string;
36
+ syncAddressBook?: boolean;
33
37
  }): Promise<ContactModel | undefined>;
@@ -47,6 +47,6 @@ export declare class Tracker {
47
47
  * Send a user engagement each 5 minutes
48
48
  */
49
49
  private processUserEngagement;
50
- trackEvent(_eventName: string, _params?: Record<string, string | number | boolean>): void;
50
+ trackEvent(eventName: string, params?: Record<string, string | number | boolean>): void;
51
51
  setUserProperty(key: string, value: any): void;
52
52
  }
@@ -14,7 +14,9 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ModelPropertiesContructor, MsgModel } from '../models';
17
- import { SendMsgResultObject } from '../types';
18
- /** @whatsapp 375399
17
+ /**
18
+ * @whatsapp >= 2.3000.1027602471
19
+ * @note Since WhatsApp Web version ~2.3000.1027602471, this function no longer returns
20
+ * a send result object. It only returns void after sending the edit message.
19
21
  */
20
- export declare function addAndSendMessageEdit(editMsg: MsgModel, message: ModelPropertiesContructor<MsgModel>): Promise<[Promise<MsgModel>, Promise<SendMsgResultObject>]>;
22
+ export declare function addAndSendMessageEdit(editMsg: MsgModel, message: ModelPropertiesContructor<MsgModel>): Promise<void>;
@@ -15,8 +15,9 @@
15
15
  */
16
16
  import { ChatModel, ModelPropertiesContructor, MsgModel } from '../models';
17
17
  import { SendMsgResultObject } from '../types';
18
- /** @whatsapp 75887
18
+ /**
19
19
  * @whatsapp 975887 >= 2.2222.8
20
20
  * @whatsapp 623631 >= 2.2228.4
21
+ * @whatsapp >= 2.3000.1030351223
21
22
  */
22
23
  export declare function addAndSendMsgToChat(chat: ChatModel, message: ModelPropertiesContructor<MsgModel>): Promise<[Promise<MsgModel>, Promise<SendMsgResultObject>]>;
@@ -14,10 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ContactModel } from '../models';
17
- /**
18
- * @whatsapp 660666 >= 2.2327.4
19
- */
20
- export declare function getMentionName(contact: ContactModel): string;
21
17
  /**
22
18
  * @whatsapp 660666 >= 2.2327.4
23
19
  */
@@ -78,10 +74,6 @@ export declare function getIsSupportAccount(contact: ContactModel): any;
78
74
  * @whatsapp 660666 >= 2.2327.4
79
75
  */
80
76
  export declare function getIsWAContact(contact: ContactModel): any;
81
- /**
82
- * @whatsapp 660666 >= 2.2327.4
83
- */
84
- export declare function getIsMyContact(contact: ContactModel): boolean;
85
77
  /**
86
78
  * @whatsapp 660666 >= 2.2327.4
87
79
  */
@@ -147,3 +139,11 @@ export declare function getFormattedName(contact: ContactModel): any;
147
139
  * @whatsapp 714574 >= 2.2327.4
148
140
  */
149
141
  export declare function getFormattedUser(contact: ContactModel): any;
142
+ /**
143
+ * @whatsapp >= 2.3000.1030318976 (last check)
144
+ */
145
+ export declare function getIsMyContact(contact: ContactModel): boolean;
146
+ /**
147
+ * @whatsapp >= 2.3000.1030318976 (last check)
148
+ */
149
+ export declare function getMentionName(contact: ContactModel): string;
@@ -13,7 +13,46 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { Wid } from '../misc';
16
17
  /**
18
+ * Deletes a contact from the contact list (legacy API).
19
+ *
17
20
  * @whatsapp WAWebDeleteContactAction >= 2.3000.0
21
+ * @whatsapp ~2.3000.1030040369
22
+ *
23
+ * @param number - Phone number string
24
+ *
25
+ * @deprecated Since around WhatsApp version 2.3000.1030110621. Use the new object-based API instead.
26
+ * Use `deleteContactActionV2({ phoneNumber: wid })` for regular contacts
27
+ * or `deleteContactActionV2({ username, lid })` for username contacts.
28
+ *
29
+ * @example
30
+ * // Deprecated usage
31
+ * await deleteContactAction('5511999999999');
32
+ *
33
+ * // Use this instead
34
+ * await deleteContactActionV2({ phoneNumber: wid });
18
35
  */
19
36
  export declare function deleteContactAction(number: string): Promise<void>;
37
+ /**
38
+ * Deletes a contact from the contact list.
39
+ *
40
+ * @whatsapp WAWebDeleteContactAction >= 2.3000.1030110621
41
+ *
42
+ * @param params - Object with contact identifiers
43
+ * @param params.phoneNumber - Contact phone number as Wid (for regular contacts)
44
+ * @param params.username - Contact username (for username contacts)
45
+ * @param params.lid - Contact LID (for username contacts)
46
+ *
47
+ * @example
48
+ * // Delete regular contact by phone number
49
+ * await deleteContactActionV2({ phoneNumber: wid });
50
+ *
51
+ * // Delete username contact
52
+ * await deleteContactActionV2({ username: 'john', lid: '123' });
53
+ */
54
+ export declare function deleteContactActionV2(params: {
55
+ phoneNumber?: Wid;
56
+ username?: string;
57
+ lid?: string;
58
+ }): Promise<void>;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function isFilterExcludedFromSearchTreatmentInInboxFlow(type?: string): void;
16
+ export declare function isFilterExcludedFromSearchTreatmentInInboxFlow(type?: string): boolean;
@@ -14,9 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  /**
17
+ * Save contact action (legacy positional parameters API)
17
18
  * @whatsapp WAWebSaveContactAction >= 2.3000.0
18
- */
19
- /**
19
+ * @deprecated Use saveContactActionV2 instead for versions >= 2.3000.1030209354
20
+ * @whatsapp WAWebSaveContactAction >= 2.3000.0, < 2.3000.1030209354
20
21
  * @param user 5521980809090
21
22
  * @param userToDelete 5521980809090
22
23
  * @param e_fullName Contact Full Name
@@ -26,3 +27,21 @@
26
27
  * @param syncToAddressbook Sync to Addressbook boolean
27
28
  */
28
29
  export declare function saveContactAction(userToCreate: string, userToDelete: string | null, e_fullName?: any, f_firstName?: any, name?: any, surname?: any, syncToAddressbook?: boolean): Promise<undefined>;
30
+ /**
31
+ * Object parameter interface for saveContactActionV2 (>= 2.3000.1030209354)
32
+ */
33
+ export interface SaveContactActionParamsV2 {
34
+ phoneNumber?: string | null;
35
+ prevPhoneNumber?: string | null;
36
+ lid?: string | null;
37
+ username?: string | null;
38
+ firstName: string;
39
+ lastName: string;
40
+ syncToAddressbook?: boolean;
41
+ }
42
+ /**
43
+ * Save contact action (new object parameter API)
44
+ * @whatsapp WAWebSaveContactAction >= 2.3000.1030209354
45
+ * @param params Contact parameters object
46
+ */
47
+ export declare function saveContactActionV2(params: SaveContactActionParamsV2): Promise<undefined>;
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * Copyright 2025 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * @whatsapp WAWebUsernameGatingUtils
18
+ */
19
+ export declare namespace UsernameGatingUtils {
20
+ /**
21
+ * Check if username feature is supported
22
+ * @whatsapp >= 2.3000.1030318976
23
+ * @returns true if username feature is supported
24
+ */
25
+ function usernameSupported(): boolean;
26
+ }
@@ -43,6 +43,7 @@ export * from './ServerProps';
43
43
  export * from './ServerPropsConstants';
44
44
  export * from './Socket';
45
45
  export * from './Stream';
46
+ export * from './UsernameGatingUtils';
46
47
  export * from './UserPrefs';
47
48
  export * from './USyncQuery';
48
49
  export * from './USyncUser';
@@ -65,7 +65,10 @@ interface Session extends SessionChatBase {
65
65
  composeQuotedMsg?: any;
66
66
  composeQuotedMsgRemoteJid?: any;
67
67
  quotedMsgAdminGroupJid?: any;
68
+ groupSafetyChecked?: boolean;
68
69
  groupMetadata?: GroupMetadataModel;
70
+ groupType?: any;
71
+ newsletterMetadata?: any;
69
72
  presence?: any;
70
73
  mute: MuteModel;
71
74
  contact?: any;
@@ -32,6 +32,7 @@ interface Props {
32
32
  labels?: string[];
33
33
  disappearingModeDuration?: any;
34
34
  disappearingModeSettingTimestamp?: any;
35
+ username?: string;
35
36
  }
36
37
  interface Session {
37
38
  stale?: any;