NewClient¶
neonize.client.NewClient
¶
NewClient(name: str, jid: Optional[JID] = None, props: Optional[DeviceProps] = None, uuid: Optional[str] = None)
Initializes a new client instance.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name or identifier for the new client.
TYPE:
|
jid
|
Optional. The JID (Jabber Identifier) for the client. If not provided, first client is used.
TYPE:
|
qrCallback
|
Optional. A callback function for handling QR code updates, defaults to None.
TYPE:
|
messageCallback
|
Optional. A callback function for handling incoming messages, defaults to None.
TYPE:
|
uuid
|
Optional. A unique identifier for the client, defaults to None.
TYPE:
|
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
Attributes¶
is_connected
property
¶
Check if the object is currently connected.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the object is connected, False otherwise. |
is_logged_in
property
¶
Check if the user is currently logged in.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the user is logged in, False otherwise. |
Functions¶
send_message
¶
send_message(to: JID, message: Union[Message, str], link_preview: bool = False, ghost_mentions: Optional[str] = None, mentions_are_lids: bool = False, add_msg_secret: bool = False) -> SendResponse
Send a message to the specified JID.
| PARAMETER | DESCRIPTION |
|---|---|
to
|
The JID to send the message to.
TYPE:
|
message
|
The message to send.
TYPE:
|
link_preview
|
Whether to send a link preview, defaults to False
TYPE:
|
ghost_mentions
|
List of users to tag silently (Takes precedence over auto detected mentions)
TYPE:
|
mentions_are_lids
|
whether mentions contained in message or ghost_mentions are lids, defaults to False.
TYPE:
|
add_msg_secret
|
Whether to generate 32 random bytes for messageSecret inside MessageContextInfo before sending, defaults to False
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SendResponse
|
The response from the server. |
| RAISES | DESCRIPTION |
|---|---|
SendMessageError
|
If there was an error sending the message. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
build_reply_message
¶
build_reply_message(message: Union[str, MessageWithContextInfo], quoted: Message, link_preview: bool = False, reply_privately: bool = False, ghost_mentions: Optional[str] = None, mentions_are_lids: bool = False) -> Message
Send a reply message to a specified JID.
| PARAMETER | DESCRIPTION |
|---|---|
message
|
The message to be sent. Can be a string or a MessageWithContextInfo object.
TYPE:
|
quoted
|
The message to be quoted in the message being sent.
TYPE:
|
link_preview
|
If set to True, enables link previews in the message being sent. Defaults to False.
TYPE:
|
reply_privately
|
If set to True, the message is sent as a private reply. Defaults to False.
TYPE:
|
ghost_mentions
|
List of users to tag silently (Takes precedence over auto detected mentions)
TYPE:
|
mentions_are_lids
|
whether mentions contained in message or ghost_mentions are lids, defaults to False.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SendResponse
|
Response of the send operation. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
reply_message
¶
reply_message(message: Union[str, MessageWithContextInfo], quoted: Message, to: Optional[JID] = None, link_preview: bool = False, reply_privately: bool = False, ghost_mentions: Optional[str] = None, mentions_are_lids: bool = False, add_msg_secret: bool = False) -> SendResponse
Send a reply message to a specified JID.
| PARAMETER | DESCRIPTION |
|---|---|
message
|
The message to be sent. Can be a string or a MessageWithContextInfo object.
TYPE:
|
quoted
|
The message to be quoted in the message being sent.
TYPE:
|
to
|
The recipient of the message. If not specified, the message is sent to the default recipient.
TYPE:
|
link_preview
|
If set to True, enables link previews in the message being sent. Defaults to False.
TYPE:
|
reply_privately
|
If set to True, the message is sent as a private reply. Defaults to False.
TYPE:
|
ghost_mentions
|
List of users to tag silently (Takes precedence over auto detected mentions)
TYPE:
|
mentions_are_lids
|
whether mentions contained in message or ghost_mentions are lids, defaults to False.
TYPE:
|
add_msg_secret
|
If set to True generate 32 random bytes for messageSecret inside MessageContextInfo before sending, defaults to False
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SendResponse
|
Response of the send operation. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
edit_message
¶
Edit a message.
| PARAMETER | DESCRIPTION |
|---|---|
chat
|
Chat ID
TYPE:
|
message_id
|
Message ID
TYPE:
|
new_message
|
New message
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SendResponse
|
Response from server |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
revoke_message
¶
Revoke a message.
| PARAMETER | DESCRIPTION |
|---|---|
chat
|
Chat ID
TYPE:
|
sender
|
Sender ID
TYPE:
|
message_id
|
Message ID
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SendResponse
|
Response from server |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
build_poll_vote_creation
¶
build_poll_vote_creation(name: str, options: List[str], selectable_count: VoteType, quoted: Optional[Message] = None) -> Message
Build a poll vote creation message.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name of the poll.
TYPE:
|
options
|
The options for the poll.
TYPE:
|
selectable_count
|
The number of selectable options.
TYPE:
|
quoted
|
A message that the poll message is a reply to, defaults to None
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Message
|
The poll vote creation message. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
build_poll_vote
¶
Builds a poll vote.
| PARAMETER | DESCRIPTION |
|---|---|
poll_info
|
The information about the poll.
TYPE:
|
option_names
|
The names of the options to vote for.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Message
|
The poll vote message. |
| RAISES | DESCRIPTION |
|---|---|
BuildPollVoteError
|
If there is an error building the poll vote. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
build_reaction
¶
This function builds a reaction message in a chat. It takes the chat and sender IDs, the message ID to which the reaction is being made, and the reaction itself as input. It then serializes the chat and sender IDs to strings, and calls the BuildReaction function of the client with these serialized IDs, the message ID, and the reaction. It finally returns the reaction message.
| PARAMETER | DESCRIPTION |
|---|---|
chat
|
The ID of the chat in which the reaction is being made
TYPE:
|
sender
|
The ID of the sender making the reaction
TYPE:
|
message_id
|
The ID of the message to which the reaction is being made
TYPE:
|
reaction
|
The reaction being made
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Message
|
The reaction message |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
build_revoke
¶
Builds a message to revoke a previous message.
| PARAMETER | DESCRIPTION |
|---|---|
chat
|
The JID (Jabber Identifier) of the chat where the message should be revoked.
TYPE:
|
sender
|
The JID of the sender of the message to be revoked.
TYPE:
|
message_id
|
The unique identifier of the message to be revoked.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Message
|
The constructed Message object for revoking the specified message. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
build_sticker_message
¶
build_sticker_message(file: Union[str, bytes], quoted: Optional[Message] = None, name: str = '', packname: str = '', crop: bool = False, enforce_not_broken: bool = False, animated_gif: bool = False, passthrough: bool = False) -> Message
This function builds a sticker message from a given image or video file. The file is converted to a webp format and uploaded to a server. The resulting URL and other metadata are used to construct the sticker message.
| PARAMETER | DESCRIPTION |
|---|---|
file
|
The path to the image or video file or the file data in bytes
TYPE:
|
quoted
|
A message that the sticker message is a reply to, defaults to None
TYPE:
|
name
|
The name of the sticker, defaults to ""
TYPE:
|
packname
|
The name of the sticker pack, defaults to ""
TYPE:
|
crop
|
Crop-center the image, defaults to False
TYPE:
|
enforce_not_broken
|
Enforce non-broken stickers by constraining sticker size to WA limits, defaults to False
TYPE:
|
animated_gif
|
Ensure transparent media are properly processed, defaults to False
TYPE:
|
passthrough
|
Don't process sticker, send as is, defaults to False.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Message
|
The constructed sticker message |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
| Python | |
|---|---|
895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 | |
send_sticker
¶
send_sticker(to: JID, file: Union[str, bytes], quoted: Optional[Message] = None, name: str = '', packname: str = '', crop: bool = False, enforce_not_broken: bool = False, animated_gif: bool = False, passthrough: bool = False, add_msg_secret: bool = False) -> SendResponse
Send a sticker to a specific JID.
| PARAMETER | DESCRIPTION |
|---|---|
to
|
The JID to send the sticker to.
TYPE:
|
file
|
The file path of the sticker or the sticker data in bytes.
TYPE:
|
quoted
|
The quoted message, if any, defaults to None.
TYPE:
|
name
|
The name of the sticker, defaults to "".
TYPE:
|
packname
|
The name of the sticker pack, defaults to "".
TYPE:
|
crop
|
Whether to crop-center the image, defaults to False
TYPE:
|
enforce_not_broken
|
Whether to enforce non-broken stickers by constraining sticker size to WA limits, defaults to False
TYPE:
|
animated_gif
|
Ensure transparent media are properly processed, defaults to False
TYPE:
|
passthrough
|
Don't process sticker, send as is, defaults to False.
TYPE:
|
add_msg_secret
|
Whether to generate 32 random bytes for messageSecret inside MessageContextInfo before sending, defaults to False
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SendResponse
|
The response from the send message function. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
send_stickerpack
¶
send_stickerpack(to: JID, files: list, quoted: Optional[Message] = None, packname: str = 'Sticker pack', publisher: str = '', crop: bool = False, animated_gif: bool = False, passthrough: bool = False, add_msg_secret: bool = False) -> List[SendResponse]
Send a sticker pack to a specific JID.
| PARAMETER | DESCRIPTION |
|---|---|
to
|
The JID to send the sticker to.
TYPE:
|
files
|
A list of file paths of the stickers or a list of stickers data in bytes.
TYPE:
|
quoted
|
The quoted message, if any, defaults to None.
TYPE:
|
packname
|
The name of the sticker pack, defaults to "Sticker pack".
TYPE:
|
publisher
|
The name of the publisher, defaults to "".
TYPE:
|
crop
|
Whether to crop-center the image, defaults to False
TYPE:
|
add_msg_secret
|
Whether to generate 32 random bytes for messageSecret inside MessageContextInfo before sending, defaults to False
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
List[SendResponse]
|
A list of response(s) from the send message function. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
build_video_message
¶
build_video_message(file: str | bytes, caption: Optional[str] = None, quoted: Optional[Message] = None, viewonce: bool = False, gifplayback: bool = False, is_gif: bool = False, ghost_mentions: Optional[str] = None, mentions_are_lids: bool = False) -> Message
This function is used to build a video message. It uploads a video file, extracts necessary information, and constructs a message with the given parameters.
| PARAMETER | DESCRIPTION |
|---|---|
file
|
The file path or bytes of the video file to be uploaded.
TYPE:
|
caption
|
The caption to be added to the video message, defaults to None
TYPE:
|
quoted
|
A message that the video message is in response to, defaults to None
TYPE:
|
viewonce
|
A flag indicating if the video message can be viewed only once, defaults to False
TYPE:
|
gifplayback
|
Optional. Whether the video should be sent as gif. Defaults to False.
TYPE:
|
is_gif
|
Optional. Whether the video to be sent is a gif. Defaults to False.
TYPE:
|
ghost_mentions
|
List of users to tag silently (Takes precedence over auto detected mentions)
TYPE:
|
mentions_are_lids
|
whether mentions contained in message or ghost_mentions are lids, defaults to False.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Message
|
A video message with the given parameters. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
| Python | |
|---|---|
1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 | |
send_video
¶
send_video(to: JID, file: str | bytes, caption: Optional[str] = None, quoted: Optional[Message] = None, viewonce: bool = False, gifplayback: bool = False, is_gif: bool = False, ghost_mentions: Optional[str] = None, mentions_are_lids: bool = False, add_msg_secret: bool = False) -> SendResponse
Sends a video to the specified recipient.
| PARAMETER | DESCRIPTION |
|---|---|
to
|
The JID (Jabber Identifier) of the recipient.
TYPE:
|
file
|
Either a file path (str), url (str) or binary data (bytes) representing the video.
TYPE:
|
caption
|
Optional. The caption of the video. Defaults to None.
TYPE:
|
quoted
|
Optional. The message to which the video is a reply. Defaults to None.
TYPE:
|
viewonce
|
Optional. Whether the video should be viewonce. Defaults to False.
TYPE:
|
gifplayback
|
Optional. Whether the video should be sent as gif. Defaults to False.
TYPE:
|
is_gif
|
Optional. Whether the video to be sent is a gif. Defaults to False.
TYPE:
|
ghost_mentions
|
List of users to tag silently (Takes precedence over auto detected mentions)
TYPE:
|
mentions_are_lids
|
whether mentions contained in message or ghost_mentions are lids, defaults to False.
TYPE:
|
add_msg_secret
|
Optional. Whether to generate 32 random bytes for messageSecret inside MessageContextInfo before sending, defaults to False
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SendResponse
|
A function for handling the result of the video sending process. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
build_image_message
¶
build_image_message(file: str | bytes, caption: Optional[str] = None, quoted: Optional[Message] = None, viewonce: bool = False, ghost_mentions: Optional[str] = None, mentions_are_lids: bool = False) -> Message
This function builds an image message. It takes a file (either a string or bytes), an optional caption, an optional quoted message, and a boolean indicating whether the message should be viewed once. It then uploads the image, generates a thumbnail, and constructs the message with the given parameters and the information from the uploaded image.
| PARAMETER | DESCRIPTION |
|---|---|
file
|
The image file to be uploaded and sent, either as a string URL or bytes.
TYPE:
|
caption
|
The caption for the image message, defaults to None.
TYPE:
|
quoted
|
The message to be quoted in the image message, defaults to None.
TYPE:
|
viewonce
|
Whether the image message should be viewable only once, defaults to False.
TYPE:
|
ghost_mentions
|
List of users to tag silently (Takes precedence over auto detected mentions)
TYPE:
|
mentions_are_lids
|
whether mentions contained in message or ghost_mentions are lids, defaults to False.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Message
|
The constructed image message. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
| Python | |
|---|---|
1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 | |
send_image
¶
send_image(to: JID, file: str | bytes, caption: Optional[str] = None, quoted: Optional[Message] = None, viewonce: bool = False, ghost_mentions: Optional[str] = None, mentions_are_lids: bool = False, add_msg_secret: bool = False) -> SendResponse
Sends an image to the specified recipient.
| PARAMETER | DESCRIPTION |
|---|---|
to
|
The JID (Jabber Identifier) of the recipient.
TYPE:
|
file
|
Either a file path (str), url (str) or binary data (bytes) representing the image.
TYPE:
|
caption
|
Optional. The caption of the image. Defaults to None.
TYPE:
|
quoted
|
Optional. The message to which the image is a reply. Defaults to None.
TYPE:
|
viewonce
|
Optional. Whether the image should be viewonce. Defaults to False.
TYPE:
|
ghost_mentions
|
List of users to tag silently (Takes precedence over auto detected mentions)
TYPE:
|
mentions_are_lids
|
whether mentions contained in message or ghost_mentions are lids, defaults to False.
TYPE:
|
add_msg_secret
|
Optional. Whether to generate 32 random bytes for messageSecret inside MessageContextInfo before sending, defaults to False
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SendResponse
|
A function for handling the result of the image sending process. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
send_album
¶
send_album(to: JID, files: list, caption: Optional[str] = None, quoted: Optional[Message] = None, ghost_mentions: Optional[str] = None, mentions_are_lids: bool = False, add_msg_secret: bool = False) -> List[SendResponse, List[SendResponse]]
Sends an album containing images, videos or both to the specified recipient.
| PARAMETER | DESCRIPTION |
|---|---|
to
|
The JID (Jabber Identifier) of the recipient.
TYPE:
|
files
|
A list containing either a file path (str), url (str) or binary data (bytes) representing the image/video.
TYPE:
|
caption
|
Optional. The caption of the first media in the album. Defaults to None.
TYPE:
|
quoted
|
Optional. The message to which the album is a reply. Defaults to None.
TYPE:
|
ghost_mentions
|
List of users to tag silently (Takes precedence over auto detected mentions)
TYPE:
|
add_msg_secret
|
Optional. Whether to generate 32 random bytes for messageSecret inside MessageContextInfo before sending, defaults to False
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
List[SendResponse, List[SendResponse]]
|
A function for handling the result of the album sending process. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
| Python | |
|---|---|
1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 | |
build_audio_message
¶
build_audio_message(file: str | bytes, ptt: bool = False, quoted: Optional[Message] = None) -> Message
This method builds an audio message from a given file or bytes.
| PARAMETER | DESCRIPTION |
|---|---|
file
|
The audio file in string or bytes format to be converted into an audio message
TYPE:
|
ptt
|
A boolean indicating if the audio message is a 'push to talk' message, defaults to False
TYPE:
|
quoted
|
A message that the audio message may be replying to, defaults to None
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Message
|
The audio message built from the given parameters |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
send_audio
¶
send_audio(to: JID, file: str | bytes, ptt: bool = False, quoted: Optional[Message] = None, add_msg_secret: bool = False) -> SendResponse
Sends an audio to the specified recipient.
| PARAMETER | DESCRIPTION |
|---|---|
to
|
The JID (Jabber Identifier) of the recipient.
TYPE:
|
file
|
Either a file path (str), url (str) or binary data (bytes) representing the audio.
TYPE:
|
ptt
|
Optional. Whether the audio should be ptt. Defaults to False.
TYPE:
|
quoted
|
Optional. The message to which the audio is a reply. Defaults to None.
TYPE:
|
add_msg_secret
|
Optional. Whether to generate 32 random bytes for messageSecret inside MessageContextInfo before sending, defaults to False
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SendResponse
|
A function for handling the result of the audio sending process. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
send_document
¶
send_document(to: JID, file: str | bytes, caption: Optional[str] = None, title: Optional[str] = None, filename: Optional[str] = None, mimetype: Optional[str] = None, quoted: Optional[Message] = None, ghost_mentions: Optional[str] = None, mentions_are_lids: bool = False, add_msg_secret: bool = False) -> SendResponse
Sends a document to the specified recipient.
| PARAMETER | DESCRIPTION |
|---|---|
to
|
The JID (Jabber Identifier) of the recipient.
TYPE:
|
file
|
Either a file path (str), url (str) or binary data (bytes) representing the document.
TYPE:
|
caption
|
Optional. The caption of the document. Defaults to None.
TYPE:
|
title
|
Optional. The title of the document. Defaults to None.
TYPE:
|
filename
|
Optional. The filename of the document. Defaults to None.
TYPE:
|
quoted
|
Optional. The message to which the document is a reply. Defaults to None.
TYPE:
|
ghost_mentions
|
List of users to tag silently (Takes precedence over auto detected mentions)
TYPE:
|
mentions_are_lids
|
whether mentions contained in message or ghost_mentions are lids, defaults to False.
TYPE:
|
add_msg_secret
|
Optional. Whether to generate 32 random bytes for messageSecret inside MessageContextInfo before sending, defaults to False
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SendResponse
|
A function for handling the result of the document sending process. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
send_contact
¶
send_contact(to: JID, contact_name: str, contact_number: str, quoted: Optional[Message] = None) -> SendResponse
Sends a contact to the specified recipient.
| PARAMETER | DESCRIPTION |
|---|---|
to
|
The JID (Jabber Identifier) of the recipient.
TYPE:
|
contact_name
|
The name of the contact.
TYPE:
|
contact_number
|
The number of the contact.
TYPE:
|
quoted
|
Optional. The message to which the contact is a reply. Defaults to None.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SendResponse
|
A function for handling the result of the contact sending process. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
upload
¶
Uploads media content.
| PARAMETER | DESCRIPTION |
|---|---|
binary
|
The binary data to be uploaded.
TYPE:
|
media_type
|
Optional. The media type of the binary data, defaults to None.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
UploadResponse
|
An UploadResponse containing information about the upload. |
| RAISES | DESCRIPTION |
|---|---|
UploadError
|
Raised if there is an issue with the upload. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
download_any
¶
Downloads content from a message.
| PARAMETER | DESCRIPTION |
|---|---|
message
|
The message containing the content to download.
TYPE:
|
path
|
Optional. The local path to save the downloaded content, defaults to None.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Union[None, bytes]
|
The downloaded content as bytes, or None if the content is not available. |
| RAISES | DESCRIPTION |
|---|---|
DownloadException
|
Raised if there is an issue with the download. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
download_media_with_path
¶
download_media_with_path(direct_path: str, enc_file_hash: bytes, file_hash: bytes, media_key: bytes, file_length: int, media_type: MediaType, mms_type: MediaTypeToMMS) -> bytes
Downloads media with the given parameters and path. The media is downloaded from the path specified.
| PARAMETER | DESCRIPTION |
|---|---|
direct_path
|
The direct path to the media to be downloaded.
TYPE:
|
enc_file_hash
|
The encrypted hash of the file.
TYPE:
|
file_hash
|
The hash of the file.
TYPE:
|
media_key
|
The key of the media to be downloaded.
TYPE:
|
file_length
|
The length of the file to be downloaded.
TYPE:
|
media_type
|
The type of the media to be downloaded.
TYPE:
|
mms_type
|
The type of the MMS to be downloaded.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bytes
|
The downloaded media in bytes. |
| RAISES | DESCRIPTION |
|---|---|
DownloadError
|
If there is an error in the download process. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
generate_message_id
¶
Generates a unique identifier for a message.
| RETURNS | DESCRIPTION |
|---|---|
str
|
A string representing the unique identifier for the message. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
send_chat_presence
¶
Sends chat presence information.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber Identifier) of the chat.
TYPE:
|
state
|
The chat presence state.
TYPE:
|
media
|
The chat presence media information.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
A string indicating the result or status of the presence information sending. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
is_on_whatsapp
¶
This function checks if the provided phone numbers are registered with WhatsApp.
| PARAMETER | DESCRIPTION |
|---|---|
numbers
|
A series of phone numbers to be checked.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Sequence[IsOnWhatsAppResponse]
|
A list of responses, each indicating whether the corresponding number is registered with WhatsApp. |
| RAISES | DESCRIPTION |
|---|---|
IsOnWhatsAppError
|
If an error occurs while verifying the phone numbers. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_user_info
¶
This function retrieves user information given a set of JID. It serializes the JID into a string, gets the user information from the client, deserializes the returned information, checks for any errors, and finally returns the user information.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
JID of the users to retrieve information from
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepeatedCompositeFieldContainer[GetUserInfoSingleReturnFunction]
|
The user information for each JID |
| RAISES | DESCRIPTION |
|---|---|
GetUserInfoError
|
If there is an error in the model returned by the client |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_group_info
¶
Retrieves information about a group.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber Identifier) of the group.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
GroupInfo
|
Information about the specified group. |
| RAISES | DESCRIPTION |
|---|---|
GetGroupInfoError
|
Raised if there is an issue retrieving group information. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_group_info_from_link
¶
Retrieves group information from a given link.
| PARAMETER | DESCRIPTION |
|---|---|
code
|
The link code.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
GroupInfo
|
An object containing the group information. |
| RAISES | DESCRIPTION |
|---|---|
GetGroupInfoError
|
If there is an error retrieving the group information. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_group_info_from_invite
¶
Retrieves group information from an invite.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber ID) of the group.
TYPE:
|
inviter
|
The JID of the user who sent the invite.
TYPE:
|
code
|
The invite code.
TYPE:
|
expiration
|
The expiration time of the invite.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
GroupInfo
|
The group information. |
| RAISES | DESCRIPTION |
|---|---|
GetGroupInfoError
|
If there is an error retrieving the group information. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
set_group_name
¶
Sets the name of a group.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber Identifier) of the group.
TYPE:
|
name
|
The new name to be set for the group.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
A string indicating the result or an error status. Empty string if successful. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
set_group_photo
¶
Sets the photo of a group.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber Identifier) of the group.
TYPE:
|
file_or_bytes
|
Either a file path (str) or binary data (bytes) representing the group photo.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
A string indicating the result or an error status. |
| RAISES | DESCRIPTION |
|---|---|
SetGroupPhotoError
|
Raised if there is an issue setting the group photo. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
set_profile_photo
¶
Sets profile photo.
| PARAMETER | DESCRIPTION |
|---|---|
file_or_bytes
|
Either a file path (str) or binary data (bytes) representing the group photo.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
A string indicating the result or an error status. |
| RAISES | DESCRIPTION |
|---|---|
SetGroupPhotoError
|
Raised if there is an issue setting the profile photo. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_lid_from_pn
¶
Retrieves the matching lid from the supplied jid.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber Identifier) (pn) of the target user.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
JID
|
The lid (hidden user) matching the supplied jid. |
| RAISES | DESCRIPTION |
|---|---|
GetJIDFromStoreError
|
Raised if there is an issue getting the lid from the given jid. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_pn_from_lid
¶
Retrieves the matching jid from the supplied lid.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber Identifier) (lid) of the target user.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
JID
|
The jid (phone number) matching the supplied lid. |
| RAISES | DESCRIPTION |
|---|---|
GetJIDFromStoreError
|
Raised if there is an issue getting the jid from the given lid. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
pin_message
¶
Currently Non-functional
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
leave_group
¶
Leaves a group.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber Identifier) of the target group.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
A string indicating the result or an error status. Empty string if successful. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_group_invite_link
¶
Gets or revokes the invite link for a group.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber Identifier) of the group.
TYPE:
|
revoke
|
Optional. If True, revokes the existing invite link; if False, gets the invite link. Defaults to False.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The group invite link or an error status. |
| RAISES | DESCRIPTION |
|---|---|
GetGroupInviteLinkError
|
Raised if there is an issue getting or revoking the invite link. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
join_group_with_link
¶
Join a group using an invite link.
| PARAMETER | DESCRIPTION |
|---|---|
code
|
The invite code or link for joining the group.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
JID
|
The JID (Jabber Identifier) of the joined group. |
| RAISES | DESCRIPTION |
|---|---|
InviteLinkError
|
Raised if the group membership is pending approval or if the link is invalid. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
join_group_with_invite
¶
This function allows a user to join a group in a chat application using an invite. It uses the JID (Jabber ID) of the group, the JID of the inviter, an invitation code, and an expiration time for the code.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID of the group to join.
TYPE:
|
inviter
|
The JID of the person who sent the invite.
TYPE:
|
code
|
The invitation code.
TYPE:
|
expiration
|
The expiration time of the invitation code.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
JoinGroupWithInviteError
|
If there is an error in joining the group, such as an invalid code or expired invitation. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
link_group
¶
Links a child group to a parent group.
| PARAMETER | DESCRIPTION |
|---|---|
parent
|
The JID of the parent group
TYPE:
|
child
|
The JID of the child group
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
LinkGroupError
|
If there is an error while linking the groups |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
mark_read
¶
mark_read(*message_ids: str, chat: JID, sender: JID, receipt: ReceiptType, timestamp: Optional[int] = None)
Marks the specified messages as read.
| PARAMETER | DESCRIPTION |
|---|---|
message_ids
|
Identifiers of the messages to mark as read.
TYPE:
|
chat
|
The JID of the chat.
TYPE:
|
sender
|
The JID of the sender.
TYPE:
|
receipt
|
The type of receipt indicating the message status.
TYPE:
|
timestamp
|
The timestamp of the read action, defaults to None.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
MarkReadError
|
If there is an error marking messages as read. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
newsletter_mark_viewed
¶
Marks the specified newsletters as viewed by the user with the given JID.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber ID) of the user who has viewed the newsletters.
TYPE:
|
message_server_ids
|
List of server IDs of the newsletters that have been viewed.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
NewsletterMarkViewedError
|
If an error occurs while marking the newsletters as viewed. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
newsletter_send_reaction
¶
newsletter_send_reaction(jid: JID, message_server_id: MessageServerID, reaction: str, message_id: str)
Sends a reaction to a newsletter.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The unique identifier for the recipient of the newsletter.
TYPE:
|
message_server_id
|
The unique identifier for the server where the message is stored.
TYPE:
|
reaction
|
The reaction to be sent.
TYPE:
|
message_id
|
The unique identifier for the message to which the reaction is being sent.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
NewsletterSendReactionError
|
If an error occurs while sending the reaction. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
newsletter_subscribe_live_updates
¶
Subscribes a user to live updates of a newsletter.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The unique identifier of the user subscribing to the newsletter.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
The duration for which the subscription is valid. |
| RAISES | DESCRIPTION |
|---|---|
NewsletterSubscribeLiveUpdatesError
|
If there is an error during the subscription process. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
newsletter_toggle_mute
¶
Toggle the mute status of a given JID.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber Identifier) of the user.
TYPE:
|
mute
|
The desired mute status. If True, the user will be muted. If False, the user will be unmuted.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
NewsletterToggleMuteError
|
If there is an error while toggling the mute status. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
resolve_business_message_link
¶
Resolves the target of a business message link.
| PARAMETER | DESCRIPTION |
|---|---|
code
|
The code of the business message link to be resolved.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
neonize_proto.BusinessMessageLinkTarget
|
The target of the business message link. |
| RAISES | DESCRIPTION |
|---|---|
ResolveContactQRLinkError
|
If an error occurs while resolving the link. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
resolve_contact_qr_link
¶
Resolves a QR link for a specific contact.
| PARAMETER | DESCRIPTION |
|---|---|
code
|
The QR code to be resolved.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
neonize_proto.ContactQRLinkTarget
|
The target contact of the QR link. |
| RAISES | DESCRIPTION |
|---|---|
ResolveContactQRLinkError
|
If an error occurs while resolving the QR link. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
send_app_state
¶
This function serializes the application state and sends it to the client. If there's an error during this process, it raises a SendAppStateError exception.
| PARAMETER | DESCRIPTION |
|---|---|
patch_info
|
Contains the information about the application state that needs to be patched.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SendAppStateError
|
If there's an error while sending the application state, this exception is raised. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
set_default_disappearing_timer
¶
Sets a default disappearing timer for messages. The timer can be specified as a timedelta or an integer. If a timedelta is provided, it is converted to nanoseconds. If an integer is provided, it is used directly as the timer.
| PARAMETER | DESCRIPTION |
|---|---|
timer
|
The duration for messages to exist before disappearing. Can be a timedelta or an integer.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SetDefaultDisappearingTimerError
|
If an error occurs while setting the disappearing timer. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
set_disappearing_timer
¶
set_disappearing_timer(jid: JID, timer: Union[timedelta, int], setting_ts: Optional[timedelta] = None)
Set a disappearing timer for a specific JID. The timer can be set as either a timedelta object or an integer. If a timedelta object is provided, it's converted into nanoseconds. If an integer is provided, it's interpreted as nanoseconds.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID for which the disappearing timer is to be set
TYPE:
|
timer
|
The duration for the disappearing timer. Can be a timedelta object or an integer representing nanoseconds.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SetDisappearingTimerError
|
If there is an error in setting the disappearing timer |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
set_force_activate_delivery_receipts
¶
This method is used to forcibly activate or deactivate the delivery receipts for a client.
| PARAMETER | DESCRIPTION |
|---|---|
active
|
This parameter determines whether the delivery receipts should be forcibly activated or deactivated. If it's True, the delivery receipts will be forcibly activated, otherwise, they will be deactivated.
TYPE:
|
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
set_group_announce
¶
Sets the announcement status of a group.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The unique identifier of the group
TYPE:
|
announce
|
The announcement status to be set. If True, announcements are enabled. If False, they are disabled.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SetGroupAnnounceError
|
If there is an error while setting the announcement status |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
set_group_locked
¶
Sets the locked status of a group identified by the given JID.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber ID) of the group to be locked/unlocked.
TYPE:
|
locked
|
The new locked status of the group. True to lock the group, False to unlock.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SetGroupLockedError
|
If the operation fails, an error with the reason for the failure is raised. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
set_group_topic
¶
Set the topic of a group in a chat application.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The unique identifier of the group
TYPE:
|
previous_id
|
The previous identifier of the topic
TYPE:
|
new_id
|
The new identifier for the topic
TYPE:
|
topic
|
The new topic to be set
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SetGroupTopicError
|
If there is an error setting the group topic |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
set_privacy_setting
¶
This method is used to set the privacy settings of a user.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name of the privacy setting to be changed.
TYPE:
|
value
|
The new value for the privacy setting.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SetPrivacySettingError
|
If there is an error while setting the privacy setting. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
set_passive
¶
Sets the passive mode of the client.
| PARAMETER | DESCRIPTION |
|---|---|
passive
|
If True, sets the client to passive mode. If False, sets the client to active mode.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SetPassiveError
|
If an error occurs while setting the client to passive mode. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
set_status_message
¶
Sets a status message for a client using the client's UUID.
| PARAMETER | DESCRIPTION |
|---|---|
msg
|
The status message to be set.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SetStatusMessageError
|
If there is an error while setting the status message. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
subscribe_presence
¶
This method is used to subscribe to the presence of a certain JID (Jabber ID).
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The Jabber ID (JID) that we want to subscribe to.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SubscribePresenceError
|
If there is an error while subscribing to the presence of the JID. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
unfollow_newsletter
¶
Unfollows a newsletter by providing the JID (Jabber ID) of the newsletter.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The Jabber ID of the newsletter to unfollow.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
UnfollowNewsletterError
|
If there is an error while attempting to unfollow the newsletter. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
unlink_group
¶
This method is used to unlink a child group from a parent group.
| PARAMETER | DESCRIPTION |
|---|---|
parent
|
The JID of the parent group from which the child group is to be unlinked.
TYPE:
|
child
|
The JID of the child group which is to be unlinked from the parent group.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
UnlinkGroupError
|
If there is an error while unlinking the child group from the parent group. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
update_blocklist
¶
Function to update the blocklist with a given action on a specific JID.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The Jabber ID (JID) of the user to be blocked or unblocked.
TYPE:
|
action
|
The action to be performed (block or unblock) on the JID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Blocklist
|
The updated blocklist. |
| RAISES | DESCRIPTION |
|---|---|
UpdateBlocklistError
|
If there is an error while updating the blocklist. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
update_group_participants
¶
update_group_participants(jid: JID, participants_changes: List[JID], action: ParticipantChange) -> RepeatedCompositeFieldContainer[GroupParticipant]
This method is used to update the list of participants in a group. It takes in the group's JID, a list of participant changes, and an action to perform.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber ID) of the group to update.
TYPE:
|
participants_changes
|
A list of JIDs representing the participants to be added or removed.
TYPE:
|
action
|
The action to perform (add, remove, promote or demote participants).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepeatedCompositeFieldContainer[GroupParticipant]
|
A list of the updated group participants. |
| RAISES | DESCRIPTION |
|---|---|
UpdateGroupParticipantsError
|
This error is raised if there is a problem updating the group participants. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
upload_newsletter
¶
Uploads the newsletter to the server.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
The newsletter content in bytes.
TYPE:
|
media_type
|
The type of media being uploaded.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
UploadResponse
|
The response from the server after the upload. |
| RAISES | DESCRIPTION |
|---|---|
UploadError
|
If there is an error during the upload process. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
create_group
¶
create_group(name: str, participants: List[JID] = [], linked_parent: Optional[GroupLinkedParent] = None, group_parent: Optional[GroupParent] = None) -> GroupInfo
Create a new group.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name of the new group.
TYPE:
|
participants
|
Optional. A list of participant JIDs (Jabber Identifiers) to be included in the group. Defaults to an empty list.
TYPE:
|
linked_parent
|
Optional. Information about a linked parent group, if applicable. Defaults to None.
TYPE:
|
group_parent
|
Optional. Information about a parent group, if applicable. Defaults to None.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
GroupInfo
|
Information about the newly created group. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_group_request_participants
¶
get_group_request_participants(jid: JID) -> RepeatedCompositeFieldContainer[GroupParticipantRequest]
Get the participants of a group request.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID of the group request.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepeatedCompositeFieldContainer[JID]
|
A list of JIDs representing the participants of the group request. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_joined_groups
¶
Get the joined groups for the current user.
| RETURNS | DESCRIPTION |
|---|---|
RepeatedCompositeFieldContainer[GroupInfo]
|
A list of :class: |
| RAISES | DESCRIPTION |
|---|---|
GetJoinedGroupsError
|
If there was an error retrieving the joined groups. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
create_newsletter
¶
create_newsletter(name: str, description: str, picture: Union[str, bytes]) -> NewsletterMetadata
Create a newsletter with the given name, description, and picture.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name of the newsletter.
TYPE:
|
description
|
The description of the newsletter.
TYPE:
|
picture
|
The picture of the newsletter. It can be either a URL or bytes.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NewsletterMetadata
|
The metadata of the created newsletter. |
| RAISES | DESCRIPTION |
|---|---|
CreateNewsletterError
|
If there is an error creating the newsletter. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
follow_newsletter
¶
Follows a newsletter with the given JID.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID of the newsletter to follow.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
None
|
None |
| RAISES | DESCRIPTION |
|---|---|
FollowNewsletterError
|
If there is an error following the newsletter. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_newsletter_info_with_invite
¶
Retrieves the newsletter information with an invite using the provided key.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
The key used to identify the newsletter.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NewsletterMetadata
|
The newsletter metadata. |
| RAISES | DESCRIPTION |
|---|---|
GetNewsletterInfoWithInviteError
|
If there is an error retrieving the newsletter information. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_newsletter_message_update
¶
get_newsletter_message_update(jid: JID, count: int, since: int, after: int) -> RepeatedCompositeFieldContainer[NewsletterMessage]
Retrieves a list of newsletter messages that have been updated since a given timestamp.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber ID) of the user.
TYPE:
|
count
|
The maximum number of messages to retrieve.
TYPE:
|
since
|
The timestamp (in milliseconds) to retrieve messages from.
TYPE:
|
after
|
The timestamp (in milliseconds) to retrieve messages after.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepeatedCompositeFieldContainer[NewsletterMessage]
|
A list of updated newsletter messages. |
| RAISES | DESCRIPTION |
|---|---|
GetNewsletterMessageUpdateError
|
If there was an error retrieving the newsletter messages. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_newsletter_messages
¶
get_newsletter_messages(jid: JID, count: int, before: MessageServerID) -> RepeatedCompositeFieldContainer[NewsletterMessage]
Retrieves a list of newsletter messages for a given JID.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The JID (Jabber Identifier) of the user.
TYPE:
|
count
|
The maximum number of messages to retrieve.
TYPE:
|
before
|
The ID of the message before which to retrieve messages.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepeatedCompositeFieldContaine[NewsletterMessage]
|
A list of newsletter messages. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_privacy_settings
¶
This function retrieves the my privacy settings.
| RETURNS | DESCRIPTION |
|---|---|
PrivacySettings
|
privacy settings |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_profile_picture
¶
get_profile_picture(jid: JID, extra: GetProfilePictureParams = neonize_proto.GetProfilePictureParams()) -> ProfilePictureInfo
This function is used to get the profile picture of a user.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The unique identifier of the user whose profile picture we want to retrieve.
TYPE:
|
extra
|
Additional parameters, defaults to neonize_proto.GetProfilePictureParams()
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ProfilePictureInfo
|
The information about the profile picture. |
| RAISES | DESCRIPTION |
|---|---|
GetProfilePictureError
|
If there is an error while trying to get the profile picture. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_status_privacy
¶
Returns the status privacy settings of the user.
| RETURNS | DESCRIPTION |
|---|---|
RepeatedCompositeFieldContainer[StatusPrivacy]
|
The status privacy settings of the user. |
| RAISES | DESCRIPTION |
|---|---|
GetStatusPrivacyError
|
If there is an error in getting the status privacy. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_sub_groups
¶
Get the subgroups of a given community.
| PARAMETER | DESCRIPTION |
|---|---|
community
|
The community for which to get the subgroups.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepeatedCompositeFieldContainer[GroupLinkTarget]
|
The subgroups of the given community. |
| RAISES | DESCRIPTION |
|---|---|
GetSubGroupsError
|
If there is an error while getting the subgroups. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_subscribed_newletters
¶
This function retrieves the newsletters the user has subscribed to.
| RETURNS | DESCRIPTION |
|---|---|
RepeatedCompositeFieldContainer[NewsletterMetadata]
|
A container with the metadata of each subscribed newsletter |
| RAISES | DESCRIPTION |
|---|---|
GetSubscribedNewslettersError
|
If there is an error while fetching the subscribed newsletters |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_user_devices
¶
Retrieve devices associated with specified user JIDs.
| PARAMETER | DESCRIPTION |
|---|---|
jids
|
Variable number of JIDs (Jabber Identifiers) of users.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepeatedCompositeFieldContainer[JID]
|
Devices associated with the specified user JIDs. |
| RAISES | DESCRIPTION |
|---|---|
GetUserDevicesError
|
If there is an error retrieving user devices. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_blocklist
¶
Retrieves the blocklist from the client.
| RETURNS | DESCRIPTION |
|---|---|
Blocklist
|
Blocklist: The retrieved blocklist. |
| RAISES | DESCRIPTION |
|---|---|
GetBlocklistError
|
If there was an error retrieving the blocklist. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_me
¶
This method is used to get the device information associated with a given UUID.
| RETURNS | DESCRIPTION |
|---|---|
Device
|
It returns a Device object created from the byte string response from the client's GetMe method. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_contact_qr_link
¶
This function returns a QR link for a specific contact. If the 'revoke' parameter is set to True, it revokes the existing QR link and generates a new one.
| PARAMETER | DESCRIPTION |
|---|---|
revoke
|
If set to True, revokes the existing QR link and generates a new one. Defaults to False.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The QR link for the contact. |
| RAISES | DESCRIPTION |
|---|---|
GetContactQrLinkError
|
If there is an error in getting the QR link. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_linked_group_participants
¶
get_linked_group_participants(community: JID) -> RepeatedCompositeFieldContainer[GroupParticipantRequest]
Fetches the participants of a linked group in a community.
| PARAMETER | DESCRIPTION |
|---|---|
community
|
The community in which the linked group belongs.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RepeatedCompositeFieldContainer[JID]
|
A list of participants in the linked group. |
| RAISES | DESCRIPTION |
|---|---|
GetLinkedGroupParticipantsError
|
If there is an error while fetching the participants. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
get_newsletter_info
¶
Fetches the metadata of a specific newsletter using its JID.
| PARAMETER | DESCRIPTION |
|---|---|
jid
|
The unique identifier of the newsletter
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
neonize_proto.NewsletterMetadata
|
The metadata of the requested newsletter |
| RAISES | DESCRIPTION |
|---|---|
GetNewsletterInfoError
|
If there is an error while fetching the newsletter information |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
PairPhone
¶
PairPhone(phone: str, show_push_notification: bool, client_name: ClientName = ClientName.LINUX, client_type: Optional[ClientType] = None)
Pair a phone with the client. This function will try to connect to the WhatsApp servers and pair the phone. If successful, it will show a push notification on the paired phone.
| PARAMETER | DESCRIPTION |
|---|---|
phone
|
The phone number to be paired.
TYPE:
|
show_push_notification
|
If true, a push notification will be shown on the paired phone.
TYPE:
|
client_name
|
The name of the client, defaults to LINUX.
TYPE:
|
client_type
|
The type of the client, defaults to None. If None, it will be set to FIREFOX or determined by the device properties.
TYPE:
|
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
| Python | |
|---|---|
3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 | |
stop
¶
Stops the client by disconnecting it from the WhatsApp servers.
get_message_for_retry
¶
get_message_for_retry(requester: JID, to: JID, message_id: str) -> typing.Union[None, Message]
This function retrieves a specific message for retrying transmission. It communicates with a client to get the message using provided requester, recipient, and message ID.
| PARAMETER | DESCRIPTION |
|---|---|
requester
|
The JID of the entity requesting the message.
TYPE:
|
to
|
The JID of the intended recipient of the message.
TYPE:
|
message_id
|
The unique identifier of the message to be retrieved.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Union[None, Message]
|
The message to be retried if found, None otherwise. |
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
decrypt_poll_vote
¶
Decrypt PollMessage
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
connect
¶
Establishes a connection to the WhatsApp servers.
Source code in .venv/lib/python3.12/site-packages/neonize/client.py
Overview¶
NewClient is the main synchronous client for interacting with WhatsApp through Neonize. It provides a complete interface for sending messages, handling media, managing groups, and responding to events.
Constructor¶
| Python | |
|---|---|
Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
name |
str |
Required | Unique identifier for this client session |
database |
str |
None |
Database connection string (SQLite or PostgreSQL) |
props |
DeviceProps |
None |
Custom device properties |
Examples¶
Connection Methods¶
connect()¶
Establish connection to WhatsApp servers.
| Python | |
|---|---|
Raises:
- ConnectionError: If connection fails
Example:
| Python | |
|---|---|
disconnect()¶
Gracefully disconnect from WhatsApp.
| Python | |
|---|---|
Example:
logout()¶
Logout from WhatsApp and clear session.
| Python | |
|---|---|
Example:
Message Methods¶
send_message()¶
Send a text message or custom message object.
| Python | |
|---|---|
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
to |
str |
Required | Recipient JID |
message |
str\|Message |
Required | Message text or Message object |
link_preview |
bool |
False |
Enable link preview |
ghost_mentions |
str |
"" |
Mention users without notification |
add_msg_secret |
bool |
False |
Add message secret |
Returns: SendResponse - Contains message ID and timestamp
Example:
reply_message()¶
Reply to a message.
| Python | |
|---|---|
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
str |
Required | Reply text |
quoted |
MessageEv |
Required | Message to reply to |
link_preview |
bool |
False |
Enable link preview |
reply_privately |
bool |
False |
Reply privately in groups |
Example:
| Python | |
|---|---|
edit_message()¶
Edit a sent message.
Example:
| Python | |
|---|---|
revoke_message()¶
Delete a message for everyone.
Example:
| Python | |
|---|---|
Media Methods¶
send_image()¶
Send an image message.
| Python | |
|---|---|
Parameters:
| Parameter | Type | Description |
|---|---|---|
to |
str |
Recipient JID |
image |
str\|bytes |
Image path, URL, or bytes |
caption |
str |
Image caption |
viewonce |
bool |
View once mode |
Example:
send_video()¶
Send a video message.
| Python | |
|---|---|
Example:
| Python | |
|---|---|
send_audio()¶
Send an audio message.
Parameters:
| Parameter | Type | Description |
|---|---|---|
to |
str |
Recipient JID |
audio |
str\|bytes |
Audio path or bytes |
ptt |
bool |
Push-to-talk (voice note) |
Example:
| Python | |
|---|---|
send_document()¶
Send a document.
| Python | |
|---|---|
Example:
| Python | |
|---|---|
send_sticker()¶
Send a sticker.
| Python | |
|---|---|
Example:
| Python | |
|---|---|
download_any()¶
Download media from a message.
Returns: bytes if path is None, else saves to file
Example:
Group Methods¶
get_group_info()¶
Get group information.
| Python | |
|---|---|
Returns: Group metadata
create_group()¶
Create a new group.
update_group_name()¶
Update group name.
Utility Methods¶
get_me()¶
Get own user information.
is_on_whatsapp()¶
Check if numbers are on WhatsApp.
| Python | |
|---|---|
mark_read()¶
Mark messages as read.
| Python | |
|---|---|
Event Decorator¶
@client.event(EventType)¶
Register event handlers for a specific event type.
| Python | |
|---|---|
Properties¶
is_connected¶
Check if client is connected.
is_logged_in¶
Check if client is logged in.
See Also¶
- NewAClient - Async version
- Events - Event types
- Examples - Usage examples