wbiztool-client 1.0.0__tar.gz

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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-2024 Anurag Meena
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include LICENSE
2
+ include README.md
3
+ recursive-include examples *.py
4
+ recursive-exclude __pycache__ *.pyc *.pyo
5
+ recursive-exclude *.egg-info *
@@ -0,0 +1,353 @@
1
+ Metadata-Version: 2.4
2
+ Name: wbiztool-client
3
+ Version: 1.0.0
4
+ Summary: Python client for the WbizTool WhatsApp messaging API
5
+ Home-page: https://github.com/anuragmeena/wbiztool-client
6
+ Author: Anurag Meena
7
+ Author-email: anuragmeena92@gmail.com
8
+ Project-URL: Documentation, https://wbiztool.com/docs/
9
+ Project-URL: Source, https://github.com/anuragmeena/wbiztool-client
10
+ Project-URL: Tracker, https://github.com/anuragmeena/wbiztool-client/issues
11
+ Keywords: wbiztool,whatsapp,api,client,messaging,communication
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.6
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Communications :: Chat
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.6
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: requests>=2.25.0
29
+ Dynamic: author
30
+ Dynamic: author-email
31
+ Dynamic: classifier
32
+ Dynamic: description
33
+ Dynamic: description-content-type
34
+ Dynamic: home-page
35
+ Dynamic: keywords
36
+ Dynamic: license-file
37
+ Dynamic: project-url
38
+ Dynamic: requires-dist
39
+ Dynamic: requires-python
40
+ Dynamic: summary
41
+
42
+ # WbizTool Client
43
+
44
+ A Python client library for the WbizTool API, making it easy to integrate WhatsApp messaging capabilities into your Python applications.
45
+
46
+ ## Installation
47
+
48
+ ```bash
49
+ pip install wbiztool-client
50
+ ```
51
+
52
+ ## Authentication
53
+
54
+ You'll need an API key and client ID from your WbizTool account:
55
+
56
+ 1. Log in to your WbizTool account
57
+ 2. Go to API Keys section
58
+ 3. Generate a new API key if you don't have one
59
+
60
+ ### Using Environment Variables
61
+
62
+ You can set your credentials as environment variables:
63
+
64
+ ```bash
65
+ export WBIZTOOL_API_KEY=your_api_key
66
+ export WBIZTOOL_CLIENT_ID=your_client_id
67
+ ```
68
+
69
+ The client will automatically use these variables if not provided explicitly during initialization.
70
+
71
+ ## Quick Start
72
+
73
+ ```python
74
+ from wbiztool_client import WbizToolClient
75
+
76
+ # Option 1: Initialize with explicit credentials
77
+ client = WbizToolClient(
78
+ api_key='your_api_key',
79
+ client_id='your_client_id' # Optional, can be provided with each request
80
+ )
81
+
82
+ # Option 2: Initialize using environment variables
83
+ client = WbizToolClient() # Will use WBIZTOOL_API_KEY and WBIZTOOL_CLIENT_ID
84
+
85
+ # Option 3: Initialize and validate credentials immediately
86
+ try:
87
+ client = WbizToolClient(validate_credentials=True)
88
+ print("Credentials are valid!")
89
+ except ValueError as e:
90
+ print(f"Invalid credentials: {e}")
91
+
92
+ # Check if API is operational
93
+ status = client.health_check()
94
+ print(status)
95
+
96
+ # Send a simple text message
97
+ response = client.send_message(
98
+ phone='919876543210', # Include country code
99
+ msg='Hello from Python!',
100
+ msg_type=0 # 0 for text message
101
+ )
102
+ print(response)
103
+ ```
104
+
105
+ ## Features
106
+
107
+ - Send text messages
108
+ - Send image messages with captions
109
+ - Send document/file messages with captions
110
+ - Upload files directly from your local system
111
+ - Send messages to multiple individual recipients
112
+ - Send messages to WhatsApp groups
113
+ - Schedule messages for future delivery
114
+ - Cancel scheduled messages
115
+ - Check message delivery status
116
+ - Get reports of sent messages
117
+ - Manage WhatsApp clients
118
+
119
+ ## API Methods
120
+
121
+ ### Authentication and Status
122
+
123
+ - `health_check()` - Check if the API is operational
124
+ - `check_credentials()` - Verify API credentials
125
+
126
+ ### Messaging
127
+
128
+ - `send_message(phone, msg, ...)` - Send a WhatsApp message to an individual
129
+ - `send_message_to_group(group_name, msg, ...)` - Send a message to a WhatsApp group
130
+ - `send_bulk_messages(phones, msg, ...)` - Send to multiple individual recipients
131
+ - `schedule_message(phone, msg, schedule_time, ...)` - Schedule a message
132
+ - `cancel_message(msg_id)` - Cancel a scheduled message
133
+ - `get_message_status(msg_id)` - Get delivery status
134
+
135
+ ### Reporting
136
+
137
+ - `get_messages_report(start_date, end_date, ...)` - Get sent messages report
138
+
139
+ ### WhatsApp Clients
140
+
141
+ - `get_whatsapp_client_status(whatsapp_client_id=None)` - Get status of all WhatsApp clients or a specific client
142
+ - `get_specific_whatsapp_client_status(whatsapp_client_id)` - Alias for checking a specific client status
143
+ - `list_whatsapp_clients()` - List all WhatsApp clients
144
+ - `create_whatsapp_client(whatsapp_number, webhook_url)` - Create a new WhatsApp client (Advanced Plan required)
145
+
146
+ ## Examples
147
+
148
+ ### Sending a Text Message
149
+
150
+ ```python
151
+ response = client.send_message(
152
+ phone='919876543210',
153
+ msg='Hello, this is a simple text message',
154
+ country_code='91',
155
+ msg_type=0, # 0 for text
156
+ webhook='https://your-webhook.com/callback' # Optional webhook for delivery notifications
157
+ )
158
+ ```
159
+
160
+ ### Sending an Image with Caption
161
+
162
+ ```python
163
+ # Using an image URL
164
+ response = client.send_message(
165
+ phone='919876543210',
166
+ msg='Check out this image!',
167
+ country_code='91',
168
+ msg_type=1, # 1 for image
169
+ img_url='https://example.com/path/to/image.jpg'
170
+ )
171
+
172
+ # OR upload a local image file
173
+ response = client.send_message(
174
+ phone='919876543210',
175
+ msg='Check out this image!',
176
+ country_code='91',
177
+ msg_type=1, # 1 for image
178
+ file_path='/path/to/local/image.jpg'
179
+ )
180
+ ```
181
+
182
+ ### Sending a Document/File with Caption
183
+
184
+ ```python
185
+ # Using a file URL
186
+ response = client.send_message(
187
+ phone='919876543210',
188
+ msg='Please see the attached document',
189
+ country_code='91',
190
+ msg_type=2, # 2 for document/file
191
+ file_url='https://example.com/path/to/document.pdf',
192
+ file_name='Important Document.pdf'
193
+ )
194
+
195
+ # OR upload a local file
196
+ response = client.send_message(
197
+ phone='919876543210',
198
+ msg='Please see the attached document',
199
+ country_code='91',
200
+ msg_type=2, # 2 for document/file
201
+ file_path='/path/to/local/document.pdf'
202
+ )
203
+ ```
204
+
205
+ ### Message with Expiry Time
206
+
207
+ ```python
208
+ # Message will expire if not delivered within 1 hour (3600 seconds)
209
+ response = client.send_message(
210
+ phone='919876543210',
211
+ msg='This message will expire if not delivered within 1 hour',
212
+ country_code='91',
213
+ expire_after_seconds=3600
214
+ )
215
+ ```
216
+
217
+ ### Sending a Message to a WhatsApp Group
218
+
219
+ ```python
220
+ # Send a text message to a WhatsApp group
221
+ response = client.send_message_to_group(
222
+ group_name='Family Group',
223
+ msg='Hello everyone in the group!',
224
+ msg_type=0 # 0 for text
225
+ )
226
+
227
+ # Send a document to a WhatsApp group
228
+ response = client.send_message_to_group(
229
+ group_name='Work Team',
230
+ msg='Here is the report for everyone',
231
+ msg_type=2, # 2 for document/file
232
+ file_url='https://example.com/path/to/report.pdf',
233
+ file_name='Team Report.pdf'
234
+ )
235
+ ```
236
+
237
+ ### Sending to Multiple Individual Recipients
238
+
239
+ ```python
240
+ # Send the same message to multiple phone numbers
241
+ response = client.send_bulk_messages(
242
+ phones=['919876543210', '919876543211', '919876543212'],
243
+ msg='This message goes to multiple individuals',
244
+ country_code='91',
245
+ msg_type=0 # 0 for text
246
+ )
247
+ ```
248
+
249
+ ### Checking WhatsApp Client Status
250
+
251
+ ```python
252
+ # Get status of all WhatsApp clients
253
+ all_clients_status = client.get_whatsapp_client_status()
254
+ print(all_clients_status)
255
+
256
+ # Get status of a specific WhatsApp client
257
+ specific_client_status = client.get_whatsapp_client_status(whatsapp_client_id=123)
258
+ # Or using the alias method
259
+ specific_client_status = client.get_specific_whatsapp_client_status(whatsapp_client_id=123)
260
+ print(specific_client_status)
261
+ ```
262
+
263
+ ### Scheduling a Message
264
+
265
+ ```python
266
+ from datetime import datetime, timedelta
267
+
268
+ # Schedule for 1 hour from now
269
+ schedule_time = (datetime.now() + timedelta(hours=1)).strftime('%Y-%m-%d %H:%M:%S')
270
+
271
+ response = client.schedule_message(
272
+ phone='919876543210',
273
+ msg='This is a scheduled message',
274
+ schedule_time=schedule_time,
275
+ country_code='91'
276
+ )
277
+ ```
278
+
279
+ ### Getting Message Reports
280
+
281
+ ```python
282
+ # Get message history for a specific date range
283
+ report = client.get_messages_report(
284
+ start_date='01-05-2023', # DD-MM-YYYY format
285
+ end_date='31-05-2023', # DD-MM-YYYY format
286
+ whatsapp_client=123, # Optional: specific WhatsApp client ID
287
+ page=1 # For pagination
288
+ )
289
+
290
+ # Print the total count of messages
291
+ print(f"Found {report['total']} messages")
292
+
293
+ # Process the message history
294
+ for message in report.get('history', []):
295
+ print(f"Message {message['id']}: {message['message_status']}")
296
+ ```
297
+
298
+ ### Canceling a Message
299
+
300
+ ```python
301
+ # Cancel a scheduled or pending message
302
+ result = client.cancel_message(msg_id=123)
303
+ if result['status'] == 1:
304
+ print("Message canceled successfully")
305
+ else:
306
+ print(f"Failed to cancel message: {result['message']}")
307
+ ```
308
+
309
+ ### Creating a WhatsApp Client
310
+
311
+ ```python
312
+ # Create a new WhatsApp client (Advanced Plan required)
313
+ result = client.create_whatsapp_client(
314
+ whatsapp_number='919876543210',
315
+ webhook_url='https://your-webhook.com/whatsapp-events'
316
+ )
317
+
318
+ if result['status'] == 1:
319
+ print(f"New WhatsApp client created with ID: {result['whatsapp_client_id']}")
320
+ else:
321
+ print(f"Failed to create WhatsApp client: {result['message']}")
322
+ ```
323
+
324
+ ### Listing WhatsApp Clients
325
+
326
+ ```python
327
+ # Get all WhatsApp clients for your account
328
+ result = client.list_whatsapp_clients()
329
+
330
+ if result['status'] == 1:
331
+ for client in result.get('whatsapp_clients', []):
332
+ print(f"Client ID: {client['whatsapp_client_id']}")
333
+ print(f"Number: {client['whatsapp_client_number']}")
334
+ print(f"Connected: {client['is_connected']}")
335
+ print("---")
336
+ else:
337
+ print(f"Failed to list WhatsApp clients: {result['message']}")
338
+ ```
339
+
340
+ ### Checking if credentials are valid at any time
341
+
342
+ ```python
343
+ # Check if credentials are valid at any time
344
+ try:
345
+ result = client.check_credentials()
346
+ print("Credentials are valid!")
347
+ except ValueError as e:
348
+ print(f"Credential error: {e}")
349
+ ```
350
+
351
+ ## License
352
+
353
+ MIT License
@@ -0,0 +1,312 @@
1
+ # WbizTool Client
2
+
3
+ A Python client library for the WbizTool API, making it easy to integrate WhatsApp messaging capabilities into your Python applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install wbiztool-client
9
+ ```
10
+
11
+ ## Authentication
12
+
13
+ You'll need an API key and client ID from your WbizTool account:
14
+
15
+ 1. Log in to your WbizTool account
16
+ 2. Go to API Keys section
17
+ 3. Generate a new API key if you don't have one
18
+
19
+ ### Using Environment Variables
20
+
21
+ You can set your credentials as environment variables:
22
+
23
+ ```bash
24
+ export WBIZTOOL_API_KEY=your_api_key
25
+ export WBIZTOOL_CLIENT_ID=your_client_id
26
+ ```
27
+
28
+ The client will automatically use these variables if not provided explicitly during initialization.
29
+
30
+ ## Quick Start
31
+
32
+ ```python
33
+ from wbiztool_client import WbizToolClient
34
+
35
+ # Option 1: Initialize with explicit credentials
36
+ client = WbizToolClient(
37
+ api_key='your_api_key',
38
+ client_id='your_client_id' # Optional, can be provided with each request
39
+ )
40
+
41
+ # Option 2: Initialize using environment variables
42
+ client = WbizToolClient() # Will use WBIZTOOL_API_KEY and WBIZTOOL_CLIENT_ID
43
+
44
+ # Option 3: Initialize and validate credentials immediately
45
+ try:
46
+ client = WbizToolClient(validate_credentials=True)
47
+ print("Credentials are valid!")
48
+ except ValueError as e:
49
+ print(f"Invalid credentials: {e}")
50
+
51
+ # Check if API is operational
52
+ status = client.health_check()
53
+ print(status)
54
+
55
+ # Send a simple text message
56
+ response = client.send_message(
57
+ phone='919876543210', # Include country code
58
+ msg='Hello from Python!',
59
+ msg_type=0 # 0 for text message
60
+ )
61
+ print(response)
62
+ ```
63
+
64
+ ## Features
65
+
66
+ - Send text messages
67
+ - Send image messages with captions
68
+ - Send document/file messages with captions
69
+ - Upload files directly from your local system
70
+ - Send messages to multiple individual recipients
71
+ - Send messages to WhatsApp groups
72
+ - Schedule messages for future delivery
73
+ - Cancel scheduled messages
74
+ - Check message delivery status
75
+ - Get reports of sent messages
76
+ - Manage WhatsApp clients
77
+
78
+ ## API Methods
79
+
80
+ ### Authentication and Status
81
+
82
+ - `health_check()` - Check if the API is operational
83
+ - `check_credentials()` - Verify API credentials
84
+
85
+ ### Messaging
86
+
87
+ - `send_message(phone, msg, ...)` - Send a WhatsApp message to an individual
88
+ - `send_message_to_group(group_name, msg, ...)` - Send a message to a WhatsApp group
89
+ - `send_bulk_messages(phones, msg, ...)` - Send to multiple individual recipients
90
+ - `schedule_message(phone, msg, schedule_time, ...)` - Schedule a message
91
+ - `cancel_message(msg_id)` - Cancel a scheduled message
92
+ - `get_message_status(msg_id)` - Get delivery status
93
+
94
+ ### Reporting
95
+
96
+ - `get_messages_report(start_date, end_date, ...)` - Get sent messages report
97
+
98
+ ### WhatsApp Clients
99
+
100
+ - `get_whatsapp_client_status(whatsapp_client_id=None)` - Get status of all WhatsApp clients or a specific client
101
+ - `get_specific_whatsapp_client_status(whatsapp_client_id)` - Alias for checking a specific client status
102
+ - `list_whatsapp_clients()` - List all WhatsApp clients
103
+ - `create_whatsapp_client(whatsapp_number, webhook_url)` - Create a new WhatsApp client (Advanced Plan required)
104
+
105
+ ## Examples
106
+
107
+ ### Sending a Text Message
108
+
109
+ ```python
110
+ response = client.send_message(
111
+ phone='919876543210',
112
+ msg='Hello, this is a simple text message',
113
+ country_code='91',
114
+ msg_type=0, # 0 for text
115
+ webhook='https://your-webhook.com/callback' # Optional webhook for delivery notifications
116
+ )
117
+ ```
118
+
119
+ ### Sending an Image with Caption
120
+
121
+ ```python
122
+ # Using an image URL
123
+ response = client.send_message(
124
+ phone='919876543210',
125
+ msg='Check out this image!',
126
+ country_code='91',
127
+ msg_type=1, # 1 for image
128
+ img_url='https://example.com/path/to/image.jpg'
129
+ )
130
+
131
+ # OR upload a local image file
132
+ response = client.send_message(
133
+ phone='919876543210',
134
+ msg='Check out this image!',
135
+ country_code='91',
136
+ msg_type=1, # 1 for image
137
+ file_path='/path/to/local/image.jpg'
138
+ )
139
+ ```
140
+
141
+ ### Sending a Document/File with Caption
142
+
143
+ ```python
144
+ # Using a file URL
145
+ response = client.send_message(
146
+ phone='919876543210',
147
+ msg='Please see the attached document',
148
+ country_code='91',
149
+ msg_type=2, # 2 for document/file
150
+ file_url='https://example.com/path/to/document.pdf',
151
+ file_name='Important Document.pdf'
152
+ )
153
+
154
+ # OR upload a local file
155
+ response = client.send_message(
156
+ phone='919876543210',
157
+ msg='Please see the attached document',
158
+ country_code='91',
159
+ msg_type=2, # 2 for document/file
160
+ file_path='/path/to/local/document.pdf'
161
+ )
162
+ ```
163
+
164
+ ### Message with Expiry Time
165
+
166
+ ```python
167
+ # Message will expire if not delivered within 1 hour (3600 seconds)
168
+ response = client.send_message(
169
+ phone='919876543210',
170
+ msg='This message will expire if not delivered within 1 hour',
171
+ country_code='91',
172
+ expire_after_seconds=3600
173
+ )
174
+ ```
175
+
176
+ ### Sending a Message to a WhatsApp Group
177
+
178
+ ```python
179
+ # Send a text message to a WhatsApp group
180
+ response = client.send_message_to_group(
181
+ group_name='Family Group',
182
+ msg='Hello everyone in the group!',
183
+ msg_type=0 # 0 for text
184
+ )
185
+
186
+ # Send a document to a WhatsApp group
187
+ response = client.send_message_to_group(
188
+ group_name='Work Team',
189
+ msg='Here is the report for everyone',
190
+ msg_type=2, # 2 for document/file
191
+ file_url='https://example.com/path/to/report.pdf',
192
+ file_name='Team Report.pdf'
193
+ )
194
+ ```
195
+
196
+ ### Sending to Multiple Individual Recipients
197
+
198
+ ```python
199
+ # Send the same message to multiple phone numbers
200
+ response = client.send_bulk_messages(
201
+ phones=['919876543210', '919876543211', '919876543212'],
202
+ msg='This message goes to multiple individuals',
203
+ country_code='91',
204
+ msg_type=0 # 0 for text
205
+ )
206
+ ```
207
+
208
+ ### Checking WhatsApp Client Status
209
+
210
+ ```python
211
+ # Get status of all WhatsApp clients
212
+ all_clients_status = client.get_whatsapp_client_status()
213
+ print(all_clients_status)
214
+
215
+ # Get status of a specific WhatsApp client
216
+ specific_client_status = client.get_whatsapp_client_status(whatsapp_client_id=123)
217
+ # Or using the alias method
218
+ specific_client_status = client.get_specific_whatsapp_client_status(whatsapp_client_id=123)
219
+ print(specific_client_status)
220
+ ```
221
+
222
+ ### Scheduling a Message
223
+
224
+ ```python
225
+ from datetime import datetime, timedelta
226
+
227
+ # Schedule for 1 hour from now
228
+ schedule_time = (datetime.now() + timedelta(hours=1)).strftime('%Y-%m-%d %H:%M:%S')
229
+
230
+ response = client.schedule_message(
231
+ phone='919876543210',
232
+ msg='This is a scheduled message',
233
+ schedule_time=schedule_time,
234
+ country_code='91'
235
+ )
236
+ ```
237
+
238
+ ### Getting Message Reports
239
+
240
+ ```python
241
+ # Get message history for a specific date range
242
+ report = client.get_messages_report(
243
+ start_date='01-05-2023', # DD-MM-YYYY format
244
+ end_date='31-05-2023', # DD-MM-YYYY format
245
+ whatsapp_client=123, # Optional: specific WhatsApp client ID
246
+ page=1 # For pagination
247
+ )
248
+
249
+ # Print the total count of messages
250
+ print(f"Found {report['total']} messages")
251
+
252
+ # Process the message history
253
+ for message in report.get('history', []):
254
+ print(f"Message {message['id']}: {message['message_status']}")
255
+ ```
256
+
257
+ ### Canceling a Message
258
+
259
+ ```python
260
+ # Cancel a scheduled or pending message
261
+ result = client.cancel_message(msg_id=123)
262
+ if result['status'] == 1:
263
+ print("Message canceled successfully")
264
+ else:
265
+ print(f"Failed to cancel message: {result['message']}")
266
+ ```
267
+
268
+ ### Creating a WhatsApp Client
269
+
270
+ ```python
271
+ # Create a new WhatsApp client (Advanced Plan required)
272
+ result = client.create_whatsapp_client(
273
+ whatsapp_number='919876543210',
274
+ webhook_url='https://your-webhook.com/whatsapp-events'
275
+ )
276
+
277
+ if result['status'] == 1:
278
+ print(f"New WhatsApp client created with ID: {result['whatsapp_client_id']}")
279
+ else:
280
+ print(f"Failed to create WhatsApp client: {result['message']}")
281
+ ```
282
+
283
+ ### Listing WhatsApp Clients
284
+
285
+ ```python
286
+ # Get all WhatsApp clients for your account
287
+ result = client.list_whatsapp_clients()
288
+
289
+ if result['status'] == 1:
290
+ for client in result.get('whatsapp_clients', []):
291
+ print(f"Client ID: {client['whatsapp_client_id']}")
292
+ print(f"Number: {client['whatsapp_client_number']}")
293
+ print(f"Connected: {client['is_connected']}")
294
+ print("---")
295
+ else:
296
+ print(f"Failed to list WhatsApp clients: {result['message']}")
297
+ ```
298
+
299
+ ### Checking if credentials are valid at any time
300
+
301
+ ```python
302
+ # Check if credentials are valid at any time
303
+ try:
304
+ result = client.check_credentials()
305
+ print("Credentials are valid!")
306
+ except ValueError as e:
307
+ print(f"Credential error: {e}")
308
+ ```
309
+
310
+ ## License
311
+
312
+ MIT License