SignalCliJSONRPCApi¶
- class pysignalclijsonrpc.SignalCliJSONRPCApi(endpoint: str, account: str | None = '', auth: tuple | None = (), verify_ssl: bool | None = True)¶
- _jsonrpc(method: str, params: object | None = None, **kwargs) dict¶
- 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) dict¶
Get group details.
- Parameters:
groupid (
str) – Group id to fetch information for.- Returns:
result (
dict)- Raises:
- get_user_status(recipients: list, **kwargs) dict¶
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¶
List groups.
- Parameters:
**kwargs –
- Arbitrary keyword arguments passed to
- Returns:
result (
list)- Raises:
- quit_group(groupid: str, delete: bool = False, **kwargs) dict¶
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) dict¶
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 (
dict)- Raises:
- send_message(recipients: list, message: str = '', mention: str = '', attachments_as_files: list | None = None, attachments_as_bytes: list | None = None, cleanup_attachments: bool = False, **kwargs) None¶
Send message.
- Parameters:
recipients (
list) – List of recipients.message (
str, optional) – Message to be sent.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) int¶
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: list | None = None, description: str = '', message_expiration_timer: int = 0, avatar_as_bytes: bytearray = bytearray(b''), **kwargs) str¶
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) bool¶
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) dict¶
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 (
dict)- Raises:
- property version: str¶
Fetch version.
- Returns:
Version of signal-cli
- Return type:
version (
str)- Raises: