talkyzap-wapp-api 1.0.3 → 1.0.5
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 +1 -6
- package/README.md +57 -0
- package/dist/call/functions/end.d.ts +5 -5
- package/dist/cart/functions/add.d.ts +20 -0
- package/dist/cart/functions/clear.d.ts +16 -0
- package/dist/cart/functions/get.d.ts +27 -0
- package/dist/cart/functions/getThumbFromCart.d.ts +16 -0
- package/dist/cart/functions/index.d.ts +22 -0
- package/dist/cart/functions/remove.d.ts +17 -0
- package/dist/cart/functions/submit.d.ts +33 -0
- package/dist/cart/functions/update.d.ts +19 -0
- package/dist/cart/index.d.ts +16 -0
- package/dist/catalog/functions/getProductById.d.ts +24 -2
- package/dist/chat/events/eventTypes.d.ts +1 -1
- package/dist/chat/functions/closeChat.d.ts +26 -0
- package/dist/chat/functions/index.d.ts +4 -1
- package/dist/chat/functions/prepareMessageButtons.d.ts +1 -1
- package/dist/chat/functions/{sendOrderMessage.d.ts → sendChargeMessage.d.ts} +28 -7
- package/dist/chat/functions/sendGroupInviteMessage.d.ts +14 -0
- package/dist/chat/functions/sendPixKeyMessage.d.ts +53 -0
- package/dist/chat/functions/sendTextMessage.d.ts +1 -1
- package/dist/chat/functions/setInputText.d.ts +20 -0
- package/dist/conn/events/eventTypes.d.ts +2 -0
- package/dist/conn/events/index.d.ts +1 -0
- package/dist/conn/events/registerLogoutReasonEvent.d.ts +16 -0
- package/dist/enums.d.ts +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/order/functions/get.d.ts +3 -3
- package/dist/privacy/functions/get.d.ts +25 -0
- package/dist/privacy/functions/getDisallowedList.d.ts +38 -0
- package/dist/privacy/functions/index.d.ts +24 -0
- package/dist/privacy/functions/prepareDisallowedList.d.ts +29 -0
- package/dist/privacy/functions/setAbout.d.ts +25 -0
- package/dist/privacy/functions/setAddGroup.d.ts +24 -0
- package/dist/privacy/functions/setLastSeen.d.ts +25 -0
- package/dist/privacy/functions/setOnline.d.ts +20 -0
- package/dist/privacy/functions/setProfilePic.d.ts +25 -0
- package/dist/privacy/functions/setReadReceipts.d.ts +20 -0
- package/dist/privacy/functions/setStatus.d.ts +22 -0
- package/dist/privacy/index.d.ts +16 -0
- package/dist/status/functions/index.d.ts +1 -0
- package/dist/status/functions/remove.d.ts +17 -0
- package/dist/status/functions/sendRawStatus.d.ts +1 -0
- package/dist/status/functions/sendTextStatus.d.ts +0 -1
- package/dist/whatsapp/enums/LogoutReason.d.ts +25 -8
- package/dist/whatsapp/functions/{isLegitErrorStack.d.ts → STATUS_JID.d.ts} +2 -2
- package/dist/whatsapp/functions/addProductToCart.d.ts +23 -0
- package/dist/whatsapp/functions/createGroup.d.ts +17 -0
- package/dist/whatsapp/functions/createOrUpdateReactions.d.ts +1 -0
- package/dist/whatsapp/functions/createOrder.d.ts +24 -0
- package/dist/whatsapp/functions/encryptAndSendStatusMsg.d.ts +35 -0
- package/dist/whatsapp/functions/getErrorCodeFromLogoutReason.d.ts +20 -0
- package/dist/whatsapp/functions/getPrivacyDisallowedListTable.d.ts +27 -0
- package/dist/whatsapp/functions/getPushname.d.ts +10 -0
- package/dist/whatsapp/functions/getStatusList.d.ts +28 -0
- package/dist/whatsapp/functions/index.d.ts +12 -1
- package/dist/whatsapp/functions/queryOrder.d.ts +32 -0
- package/dist/whatsapp/functions/revokeStatus.d.ts +20 -0
- package/dist/whatsapp/functions/setPrivacyForOneCategory.d.ts +48 -0
- package/dist/whatsapp/functions/statusEnable.d.ts +19 -0
- package/dist/whatsapp/functions/updateCart.d.ts +20 -0
- package/dist/whatsapp/misc/ComposeBoxActions.d.ts +34 -0
- package/dist/whatsapp/misc/IsOfficialClient.d.ts +1 -0
- package/dist/whatsapp/misc/MsgKey.d.ts +1 -1
- package/dist/whatsapp/misc/Wid.d.ts +2 -0
- package/dist/whatsapp/misc/index.d.ts +1 -0
- package/dist/whatsapp/models/CartItemModel.d.ts +1 -0
- package/dist/whatsapp/models/index.d.ts +0 -1
- package/dist/wppconnect-wa.js +1 -1
- package/dist/wppconnect-wa.js.LICENSE.txt +1 -1
- package/package.json +27 -27
- package/dist/whatsapp/models/CallParticipantModel.d.ts +0 -50
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -19,6 +19,13 @@
|
|
|
19
19
|
[](https://chat.whatsapp.com/LJaQu6ZyNvnBPNAVRbX00K)
|
|
20
20
|
[](https://www.youtube.com/c/wppconnect)
|
|
21
21
|
|
|
22
|
+
|
|
23
|
+
### Top Contributors (last 45 days) widget
|
|
24
|
+
---
|
|
25
|
+

|
|
26
|
+
---
|
|
27
|
+
<sup><sub>Check also our [Public Dashboard](https://app.devactivity.com/public/?organizationLogin=wppconnect-team) powered by [devActivity](https://devactivity.com/?ref=public_widget)</sub></sup>
|
|
28
|
+
|
|
22
29
|
## How does it work
|
|
23
30
|
|
|
24
31
|
This project extract some functions of WhatsApp sources, that uses webpack.
|
|
@@ -40,6 +47,56 @@ There are a convection name for some exported modules:
|
|
|
40
47
|
- `...Collection` - Class for collection of models (`ChatCollection`, `MsgCollection`)
|
|
41
48
|
- `...Store` - Default and global instance of a collection (`ChatStore`, `MsgStore`)
|
|
42
49
|
|
|
50
|
+
## Some Available functions
|
|
51
|
+
### General Functions
|
|
52
|
+
`WPP.conn.connect` - Connect to WhatsApp Web
|
|
53
|
+
|
|
54
|
+
`WPP.conn.isAuthenticated` - Check if the connection is authenticated
|
|
55
|
+
|
|
56
|
+
`WPP.conn.logout` - Logout from WhatsApp Web
|
|
57
|
+
|
|
58
|
+
### Chat Functions
|
|
59
|
+
`WPP.chat.sendTextMessage` - Send a text message
|
|
60
|
+
|
|
61
|
+
`WPP.chat.sendImageMessage` - Send an image message
|
|
62
|
+
|
|
63
|
+
`WPP.chat.sendVideoMessage` - Send a video message
|
|
64
|
+
|
|
65
|
+
`WPP.chat.sendFileMessage` - Send a file message
|
|
66
|
+
|
|
67
|
+
`WPP.chat.sendAudioMessage` - Send an audio message
|
|
68
|
+
|
|
69
|
+
`WPP.chat.getChat` - Get chat details
|
|
70
|
+
|
|
71
|
+
`WPP.chat.deleteMessage` - Delete a message
|
|
72
|
+
|
|
73
|
+
### Contact Functions
|
|
74
|
+
`WPP.contact.getContact` - Get contact details
|
|
75
|
+
|
|
76
|
+
`WPP.contact.blockContact` - Block a contact
|
|
77
|
+
|
|
78
|
+
`WPP.contact.unblockContact` - Unblock a contact
|
|
79
|
+
|
|
80
|
+
`WPP.contact.getAllContacts` - Get all contacts
|
|
81
|
+
|
|
82
|
+
### Group Functions
|
|
83
|
+
`WPP.group.createGroup` - Create a new group
|
|
84
|
+
|
|
85
|
+
`WPP.group.addParticipant` - Add a participant to a group
|
|
86
|
+
|
|
87
|
+
`WPP.group.removeParticipant` - Remove a participant from a group.
|
|
88
|
+
|
|
89
|
+
`WPP.group.promoteParticipant` - Promote a participant to admin
|
|
90
|
+
|
|
91
|
+
`WPP.group.demoteParticipant` - Demote a participant from admin.
|
|
92
|
+
|
|
93
|
+
`WPP.group.getGroupInfo` - Get group information.
|
|
94
|
+
|
|
95
|
+
### Events
|
|
96
|
+
`WPP.chat.on('chat.new_message')` - Event to dispatch on receive a new message
|
|
97
|
+
|
|
98
|
+
To see all events, check: [https://wppconnect.io/wa-js/types/ev.EventTypes.html](https://wppconnect.io/wa-js/types/ev.EventTypes.html)
|
|
99
|
+
|
|
43
100
|
## Development
|
|
44
101
|
|
|
45
102
|
Steps to run locally:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
/**
|
|
17
|
-
* End a
|
|
17
|
+
* End a call
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```javascript
|
|
21
|
-
* // End any
|
|
21
|
+
* // End any call
|
|
22
22
|
* WPP.call.end();
|
|
23
23
|
*
|
|
24
24
|
* // End specific call id
|
|
25
25
|
* WPP.call.end(callId);
|
|
26
26
|
*
|
|
27
|
-
* // End any
|
|
28
|
-
* WPP.on('call.
|
|
27
|
+
* // End any incoming call
|
|
28
|
+
* WPP.on('call.incoming_call', (call) => {
|
|
29
29
|
* WPP.call.end(call.id);
|
|
30
30
|
* });
|
|
31
31
|
* ```
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
import { CartModel } from '../../whatsapp';
|
|
17
|
+
export declare function add(chatId: string, products: {
|
|
18
|
+
id: string;
|
|
19
|
+
qnt: number;
|
|
20
|
+
}[]): Promise<CartModel | undefined>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 declare function clear(wid: string): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Get products in cart chat
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```javascript
|
|
21
|
+
* const cart = WPP.cart.get('[number]@c.us');
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @category Cart
|
|
25
|
+
*/
|
|
26
|
+
import { CartModel } from '../../whatsapp';
|
|
27
|
+
export declare function get(wid: string): CartModel | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 declare function getThumbFromCart(wid: string): Promise<string>;
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { add } from './add';
|
|
17
|
+
export { clear } from './clear';
|
|
18
|
+
export { get } from './get';
|
|
19
|
+
export { getThumbFromCart } from './getThumbFromCart';
|
|
20
|
+
export { remove } from './remove';
|
|
21
|
+
export { submit } from './submit';
|
|
22
|
+
export { update } from './update';
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
import { CartModel } from '../../whatsapp';
|
|
17
|
+
export declare function remove(chatId: string, productId: string): Promise<CartModel | undefined>;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Send a request order to business chat
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```javascript
|
|
21
|
+
* const cart = WPP.cart.submit('[number]@c.us');
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```javascript
|
|
26
|
+
* // Send cart with a custom message
|
|
27
|
+
* const cart = WPP.cart.submit('[number]@c.us', 'Custom message here');
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @category Cart
|
|
31
|
+
*/
|
|
32
|
+
import { SendMessageOptions } from '../../chat';
|
|
33
|
+
export declare function submit(wid: string, msg?: string, options?: SendMessageOptions): Promise<any>;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
import { CartModel } from '../../whatsapp';
|
|
17
|
+
export declare function update(chatId: string, productId: string, options: {
|
|
18
|
+
quantity: number;
|
|
19
|
+
}): Promise<CartModel | undefined>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 * from './functions';
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ProductModel } from '../../whatsapp';
|
|
17
16
|
/**
|
|
18
17
|
* Retrieves product by id
|
|
19
18
|
*
|
|
@@ -25,4 +24,27 @@ import { ProductModel } from '../../whatsapp';
|
|
|
25
24
|
*
|
|
26
25
|
* @category Catalog
|
|
27
26
|
*/
|
|
28
|
-
export declare function getProductById(chatId: string, productId: number): Promise<
|
|
27
|
+
export declare function getProductById(chatId: string, productId: number): Promise<{
|
|
28
|
+
id: string;
|
|
29
|
+
retailer_id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
url: string;
|
|
33
|
+
currency: string;
|
|
34
|
+
price: string;
|
|
35
|
+
is_hidden: boolean;
|
|
36
|
+
max_available: number;
|
|
37
|
+
availability: string;
|
|
38
|
+
checkmark: boolean;
|
|
39
|
+
image_hashes_for_whatsapp: string[];
|
|
40
|
+
image_cdn_urls: {
|
|
41
|
+
key: 'requested' | 'full';
|
|
42
|
+
value: string;
|
|
43
|
+
}[];
|
|
44
|
+
additional_image_cdn_urls: any[];
|
|
45
|
+
whatsapp_product_can_appeal: boolean;
|
|
46
|
+
capability_to_review_status: {
|
|
47
|
+
key: 'WHATSAPP';
|
|
48
|
+
value: 'APPROVED';
|
|
49
|
+
}[];
|
|
50
|
+
}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Close the chat tab
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```javascript
|
|
21
|
+
* await WPP.chat.closeChat();
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @category Chat
|
|
25
|
+
*/
|
|
26
|
+
export declare function closeChat(): Promise<boolean>;
|
|
@@ -18,6 +18,7 @@ export { canMarkPlayed } from './canMarkPlayed';
|
|
|
18
18
|
export { canMute } from './canMute';
|
|
19
19
|
export { canReply } from './canReply';
|
|
20
20
|
export { clear } from './clear';
|
|
21
|
+
export { closeChat } from './closeChat';
|
|
21
22
|
export { delete } from './delete';
|
|
22
23
|
export { deleteMessage, DeleteMessageReturn } from './deleteMessage';
|
|
23
24
|
export { downloadMedia } from './downloadMedia';
|
|
@@ -54,16 +55,18 @@ export { LinkPreviewOptions, prepareLinkPreview } from './prepareLinkPreview';
|
|
|
54
55
|
export { MessageButtonsOptions, prepareMessageButtons, } from './prepareMessageButtons';
|
|
55
56
|
export { prepareRawMessage } from './prepareRawMessage';
|
|
56
57
|
export { requestPhoneNumber } from './requestPhoneNumber';
|
|
58
|
+
export { OrderItems, OrderMessageOptions, sendChargeMessage, } from './sendChargeMessage';
|
|
57
59
|
export { PoolMessageOptions, sendCreatePollMessage, } from './sendCreatePollMessage';
|
|
58
60
|
export { AudioMessageOptions, AutoDetectMessageOptions, DocumentMessageOptions, FileMessageOptions, ImageMessageOptions, sendFileMessage, StickerMessageOptions, VideoMessageOptions, } from './sendFileMessage';
|
|
59
61
|
export { GroupInviteMessage, sendGroupInviteMessage, } from './sendGroupInviteMessage';
|
|
60
62
|
export { ListMessageOptions, sendListMessage } from './sendListMessage';
|
|
61
63
|
export { LocationMessageOptions, sendLocationMessage, } from './sendLocationMessage';
|
|
62
|
-
export {
|
|
64
|
+
export { sendPixKeyMessage } from './sendPixKeyMessage';
|
|
63
65
|
export { sendRawMessage } from './sendRawMessage';
|
|
64
66
|
export { sendReactionToMessage } from './sendReactionToMessage';
|
|
65
67
|
export { ScheduledCallMessageOptions, sendScheduledCallMessage, } from './sendScheduledCallMessage';
|
|
66
68
|
export { sendTextMessage, TextMessageOptions } from './sendTextMessage';
|
|
67
69
|
export { sendVCardContactMessage, VCardContact, } from './sendVCardContactMessage';
|
|
70
|
+
export { setInputText } from './setInputText';
|
|
68
71
|
export { starMessage, StarMessageReturn } from './starMessage';
|
|
69
72
|
export { unmute } from './unmute';
|
|
@@ -43,7 +43,7 @@ export interface MessageButtonsOptions {
|
|
|
43
43
|
* Set to use interactive message instead of reply buttons.
|
|
44
44
|
* @default: undefined - auto detect
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
useInteractiveMessage?: boolean | null;
|
|
47
47
|
/**
|
|
48
48
|
* Footer text for buttons
|
|
49
49
|
*/
|
|
@@ -27,6 +27,12 @@ export interface OrderMessageOptions extends SendMessageOptions {
|
|
|
27
27
|
tax?: number;
|
|
28
28
|
shipping?: number;
|
|
29
29
|
offset?: number;
|
|
30
|
+
pix?: {
|
|
31
|
+
keyType: 'CNPJ' | 'CPF' | 'PHONE' | 'EMAIL' | 'EVP';
|
|
32
|
+
name: string;
|
|
33
|
+
key: string;
|
|
34
|
+
};
|
|
35
|
+
payment_instruction?: string;
|
|
30
36
|
}
|
|
31
37
|
/**
|
|
32
38
|
* Send a order message
|
|
@@ -34,24 +40,39 @@ export interface OrderMessageOptions extends SendMessageOptions {
|
|
|
34
40
|
*
|
|
35
41
|
* @example
|
|
36
42
|
* ```javascript
|
|
37
|
-
* // Send
|
|
38
|
-
* WPP.chat.
|
|
43
|
+
* // Send charge with a product
|
|
44
|
+
* WPP.chat.sendChargeMessage('[number]@c.us', [
|
|
39
45
|
* { type: 'product', id: '67689897878', qnt: 2 },
|
|
40
46
|
* { type: 'product', id: '37878774457', qnt: 1 },
|
|
41
47
|
* ]
|
|
42
48
|
*
|
|
43
|
-
* // Send
|
|
44
|
-
* WPP.chat.
|
|
49
|
+
* // Send charge with a custom item
|
|
50
|
+
* WPP.chat.sendChargeMessage('[number]@c.us', [
|
|
45
51
|
* { type: 'custom', name: 'Item de cost test', price: 120000, qnt: 2 },
|
|
46
52
|
* ]
|
|
47
53
|
*
|
|
48
|
-
* // Send
|
|
49
|
-
* WPP.chat.
|
|
54
|
+
* // Send charge with custom options
|
|
55
|
+
* WPP.chat.sendChargeMessage('[number]@c.us', [
|
|
50
56
|
* { type: 'product', id: '37878774457', qnt: 1 },
|
|
51
57
|
* { type: 'custom', name: 'Item de cost test', price: 120000, qnt: 2 },
|
|
52
58
|
* ],
|
|
53
59
|
* { tax: 10000, shipping: 4000, discount: 10000 }
|
|
60
|
+
*
|
|
61
|
+
* // Send charge with Pix data (auto generate copy-paste pix code)
|
|
62
|
+
* WPP.chat.sendChargeMessage('[number]@c.us', [
|
|
63
|
+
* { type: 'custom', name: 'Item de cost test', price: 120000, qnt: 2 },
|
|
64
|
+
* ],
|
|
65
|
+
* {
|
|
66
|
+
* tax: 10000,
|
|
67
|
+
* shipping: 4000,
|
|
68
|
+
* discount: 10000,
|
|
69
|
+
* pix: {
|
|
70
|
+
* keyType: 'CPF',
|
|
71
|
+
* key: '00555095999',
|
|
72
|
+
* name: 'Name of seller',
|
|
73
|
+
* },
|
|
74
|
+
* });
|
|
54
75
|
* ```
|
|
55
76
|
* @category Message
|
|
56
77
|
*/
|
|
57
|
-
export declare function
|
|
78
|
+
export declare function sendChargeMessage(chatId: any, items: OrderItems[], options?: OrderMessageOptions): Promise<SendMessageReturn>;
|
|
@@ -35,6 +35,20 @@ export interface GroupInviteMessage extends SendMessageOptions {
|
|
|
35
35
|
* groupId: '789@g.us'
|
|
36
36
|
* }
|
|
37
37
|
* );
|
|
38
|
+
*
|
|
39
|
+
* // After a invite
|
|
40
|
+
* const result = await WPP.group.addParticipants('789@g.us', '123@c.us');
|
|
41
|
+
* const participant = result['123@c.us'];
|
|
42
|
+
* if (participant.invite_code) {
|
|
43
|
+
* WPP.chat.sendGroupInviteMessage(
|
|
44
|
+
* '123@c.us',
|
|
45
|
+
* {
|
|
46
|
+
* inviteCode: participant.invite_code,
|
|
47
|
+
* inviteCodeExpiration: participant.invite_code_exp,
|
|
48
|
+
* groupId: '789@g.us'
|
|
49
|
+
* }
|
|
50
|
+
* );
|
|
51
|
+
* }
|
|
38
52
|
* ```
|
|
39
53
|
*
|
|
40
54
|
* @category Message
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
import { SendMessageOptions, SendMessageReturn } from '..';
|
|
17
|
+
export interface OrderItems {
|
|
18
|
+
type: 'product' | 'custom';
|
|
19
|
+
id?: number[] | string[];
|
|
20
|
+
name?: string;
|
|
21
|
+
price?: number;
|
|
22
|
+
qnt?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface OrderMessageOptions extends SendMessageOptions {
|
|
25
|
+
notes?: string;
|
|
26
|
+
discount?: number;
|
|
27
|
+
tax?: number;
|
|
28
|
+
shipping?: number;
|
|
29
|
+
offset?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Send a invoice message
|
|
33
|
+
* To send (prices, tax, shipping or discount), for example: USD 12.90, send them without dots or commas, like: 12900
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```javascript
|
|
37
|
+
* // Send PIX Key Message (Brazil Pix Key)
|
|
38
|
+
* WPP.chat.sendPixKeyMessage('[number]@c.us', {
|
|
39
|
+
* keyType: 'CNPJ',
|
|
40
|
+
* name: 'WPPCONNECT-TEAM',
|
|
41
|
+
* key: '33460516000178',
|
|
42
|
+
* instructions: 'Pay text for instructions here',
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* ```
|
|
46
|
+
* @category Message
|
|
47
|
+
*/
|
|
48
|
+
export declare function sendPixKeyMessage(chatId: any, params: {
|
|
49
|
+
keyType: 'CNPJ' | 'CPF' | 'PHONE' | 'EMAIL' | 'EVP';
|
|
50
|
+
name: string;
|
|
51
|
+
key: string;
|
|
52
|
+
instructions?: string;
|
|
53
|
+
}, options?: SendMessageOptions): Promise<SendMessageReturn>;
|
|
@@ -26,7 +26,7 @@ export type TextMessageOptions = SendMessageOptions & MessageButtonsOptions & Li
|
|
|
26
26
|
*
|
|
27
27
|
* // With Buttons
|
|
28
28
|
* WPP.chat.sendTextMessage('[number]@c.us', 'Hello', {
|
|
29
|
-
*
|
|
29
|
+
* useInteractiveMessage: true, // False for legacy
|
|
30
30
|
* buttons: [
|
|
31
31
|
* {
|
|
32
32
|
* url: 'https://wppconnect.io/',
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
import { Wid } from '../../whatsapp';
|
|
17
|
+
export declare function setInputText(text: string, chatId?: string | Wid): Promise<{
|
|
18
|
+
text: string;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
}>;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { LogoutReason } from '../../whatsapp/enums';
|
|
16
17
|
import { AuthCode } from '../types';
|
|
17
18
|
export interface ConnEventTypes {
|
|
18
19
|
'conn.auth_code_change': AuthCode | null;
|
|
@@ -28,6 +29,7 @@ export interface ConnEventTypes {
|
|
|
28
29
|
*/
|
|
29
30
|
'conn.authenticated': undefined;
|
|
30
31
|
'conn.logout': undefined;
|
|
32
|
+
'conn.logout_reason': LogoutReason;
|
|
31
33
|
/**
|
|
32
34
|
* Triggered when the interface is booting
|
|
33
35
|
*
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import './registerAuthCodeChangeEvent';
|
|
17
17
|
import './registerAuthenticatedEvent';
|
|
18
18
|
import './registerLogoutEvent';
|
|
19
|
+
import './registerLogoutReasonEvent';
|
|
19
20
|
import './registerMainInit';
|
|
20
21
|
import './registerMainLoadedEvent';
|
|
21
22
|
import './registerMainReadyEvent';
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
package/dist/enums.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export { isInjected, isReady, isFullReady } from './webpack';
|
|
|
22
22
|
export { config, Config } from './config';
|
|
23
23
|
export * as blocklist from './blocklist';
|
|
24
24
|
export * as call from './call';
|
|
25
|
+
export * as cart from './cart';
|
|
26
|
+
export * as privacy from './privacy';
|
|
25
27
|
export * as catalog from './catalog';
|
|
26
28
|
export * as chat from './chat';
|
|
27
29
|
export * as conn from './conn';
|