SignalCliJSONRPCApi#
- class pysignalclijsonrpc.SignalCliJSONRPCApi(endpoint: str, account: str, auth: tuple = (), verify_ssl: bool = True)#
- _jsonrpc(method: str, params: Optional[object] = None, **kwargs)#
- Parameters:
method (str) – JSON-RPC method. Equals signal-cli command.
params (dict) – Method parameters.
**kwargs – Arbitrary keyword arguments.
- Returns:
The JSON-RPC result.
- Return type:
result (dict)
- Raises:
- get_group(groupid: str)#
Get group details.
- Parameters:
groupid (str) – Group id to fetch information for.
- Returns:
result (dict)
- Raises:
- get_user_status(recipients: list, **kwargs)#
Get user network status (is registered?).
- Parameters:
recipients (list) – List of str where each item is a phone number.
**kwargs – Arbitrary keyword arguments passed to
_jsonrpc().
- Returns:
The network result.
- Return type:
result (dict)
- Raises:
- join_group(uri: str, **kwargs)#
Join group.
- Parameters:
uri (str) – Group invite link like https://signal.group/#…
**kwargs – Arbitrary keyword arguments passed to
_jsonrpc().
- Raises:
- list_groups(**kwargs)#
List groups.
- Parameters:
**kwargs –
- Arbitrary keyword arguments passed to
- Returns:
result (list)
- Raises:
- quit_group(groupid: str, delete: bool = False, **kwargs)#
Quit (leave) group.
- Parameters:
groupid (str) – Group id to quit (leave).
delete (bool, optional) – Also delete group. Defaults to False.
**kwargs – Arbitrary keyword arguments passed to
_jsonrpc().
- Returns:
result (dict)
- Raises:
- register(captcha: str = '', voice: bool = False, **kwargs)#
Register account.
- Parameters:
captcha (str, optional) – The captcha token, required if registration failed with a captcha required error.
voice (bool) – The verification should be done over voice, not SMS. Defaults to False.
**kwargs – Arbitrary keyword arguments passed to
_jsonrpc().
- Returns:
The network result. {} if successful.
- Return type:
result
- Raises:
- send_message(message: str, recipients: list, mention: str = '', attachments_as_files: Optional[list] = None, attachments_as_bytes: Optional[list] = None, cleanup_attachments: bool = False, **kwargs)#
Send message.
- Parameters:
message (str) – Message to be sent.
recipients (list) – List of recipients.
mention (str, optional) – Mention string (start:end:recipientNumber).
attachments_as_files – (list, optional): List of str w/ files to send as attachment(s).
attachments_as_bytes (list, optional) – List of bytearray to send as attachment(s).
cleanup_attachments (bool, optional) – Wether to remove files in attachments_as_files after message(s) has been sent. Defaults to False.
**kwargs – Arbitrary keyword arguments passed to
_jsonrpc().
- Returns:
- Dictionary of timestamps and related recipients.
Example: {‘timestamps’: {timestamp: {‘recipients’: [’…’]}}}
- Return type:
result (dict)
- Raises:
- send_reaction(recipient: str, emoji: str, target_author: str, target_timestamp: int, remove: bool = False, groupid: str = '', **kwargs)#
Send reaction.
- Parameters:
recipient (str) – Specify the recipients’ phone number.
emoji (str) – Specify the emoji, should be a single unicode grapheme cluster.
target_author (str) – Specify the number of the author of the message to which to react.
target_timestamp (int) – Specify the timestamp of the message to which to react.
remove (bool, optional) – Remove an existing reaction. Defaults to False.
groupid (str, optional) – Specify the recipient group ID.
**kwargs – Arbitrary keyword arguments passed to
_jsonrpc().
- Returns:
Timestamp of reaction.
- Return type:
timestamp (int)
- Raises:
- update_group(name: str, members: list, add_member_permissions: str = 'only-admins', edit_group_permissions: str = 'only-admins', group_link: str = 'disabled', admins: Optional[list] = None, description: str = '', message_expiration_timer: int = 0, avatar_as_bytes: bytearray = bytearray(b''), **kwargs)#
Update (create) a group.
- Parameters:
name (str) – Group name.
members (list) – Group members. List of strings.
add_member_permissions (str, optional) – Group permissions for adding members. every-member or only-admins (default).
edit_group_permissions (str, optional) – Group permissions for editing settings/details. every-member or only-admins (default).
group_link (GroupLinkChoices, optional) – Group Link settings. One of disabled (default), enabled or enabled-with-approval.
admins (list, optional) – List of additional group admins.
description (str, optional) – Group description.
message_expiration_timer (int, optional) – Message expiration timer in seconds. Defaults to 0 (disabled).
avatar_as_bytes (bytearray, optional) – bytearray containing image to set as avatar. Supported since signal-cli 0.11.6.
**kwargs – Arbitrary keyword arguments passed to
_jsonrpc().
- Returns:
The group id.
- Return type:
group_id (str)
- Raises:
- update_profile(given_name: str = '', family_name: str = '', about: str = '', avatar_as_bytes: bytearray = bytearray(b''), **kwargs)#
Update profile.
- Parameters:
given_name (str, optional) – Given name.
family_name (str, optional) – Family name.
about (str, optional) – About information.
avatar_as_bytes (bytearray, optional) – bytearray containing image to set as avatar. Supported since signal-cli 0.11.6.
- Returns:
True for success.
- Return type:
result (bool)
- Raises:
- verify(verification_code: str, pin: str = '', **kwargs)#
Verify pending account registration.
- Parameters:
verification_code (str) – The verification code you received via sms or voice call.
pin (str, optional) – The registration lock PIN, that was set by the user.
**kwargs – Arbitrary keyword arguments passed to
pysignalclijsonrpc.SignalCliJSONRPCApi._jsonrpc().
- Returns:
The network result. {} if successful.
- Return type:
result
- Raises:
- property version#
Fetch version.
- Returns:
Version of signal-cli
- Return type:
version (str)
- Raises: