/////
vim:set ts=4 sw=4 tw=82 noet:
/////
:quotes.~:

= signal-cli-dbus (5)

== Name

DBus API for signal-cli - A commandline and dbus interface for the Signal messenger

== Synopsis

*signal-cli* [--verbose] [--config CONFIG] [-u USERNAME] [-o {plain-text,json}] daemon [--system]

*dbus-send* [--system | --session] [--print-reply] --type=method_call --dest="org.asamk.Signal" /org/asamk/Signal[/_<phonenum>] org.asamk.Signal.<method> [string:<string argument>] [array:<type>:<array argument>]

Note: when daemon was started without explicit `-u USERNAME`, the `dbus-send` command requires adding the phone number in `/org/asamk/Signal/_<phonenum>`.

== Description

See signal-cli (1) for details on the application.

This documentation handles the supported methods when running signal-cli as a DBus daemon.

The method are described as follows:

method(arg1<type>, arg2<type>, ...) -> return<type>

Where <type> is according to DBus specification:

* <a>   : Array of ...
* <s>   : String
* <y>   : Byte
* <b>   : Boolean (false|true)
* <x>   : Signed 64-bit integer (long)
* <i>   : Signed 32-bit integer (int)
* <>    : no return value

Exceptions are the names of the Java Exceptions returned in the body field. They typically contain an additional message with details. All Exceptions begin with "org.asamk.Signal.Error." which is omitted here for better readability.

Phone numbers always have the format +<countrycode><regional number>

== Methods for org.asamk.Signal

updateGroup(groupId<ay>, name<s>, addMembers<as>, avatar<s>) -> groupId<ay>::
updateGroup(base64GroupId<s>, name<s>, addMembers<as>, avatar<s>) -> base64GroupId<s>::
updateGroup(groupId<ay>, name<s>, description<s>, addMembers<s>, removeMembers<s>, addAdmins<s>, removeAdmins<s>, resetGroupLink<b>, groupLinkState<s>, addMemberPermission<s>, editDetailsPermission<s>, avatar<s> expiration<i>) -> groupId<ay>::
updateGroup(base64GroupId<s>, name<s>, description<s>, addMembers<s>, removeMembers<s>, addAdmins<s>, removeAdmins<s>, resetGroupLink<b>, groupLinkState<s>, addMemberPermission<s>, editDetailsPermission<s>, avatar<s> expiration<i>) -> base64GroupId<s>::
* groupId               : Byte array representing the internal group identifier (create new group if null)
* base64GroupId         : String representing the internal group identifier in Base64 format (create new group if empty)
* name                  : Name of group (empty if unchanged)
* description           : Description (empty if unchanged)
* addMembers            : String array of new members to be invited to group (empty if unchanged)
* removeMembers         : String array of members to be removed from group (empty if unchanged)
* addAdmins             : String array of members granted admin privileges (empty if unchanged)
* removeAdmins          : String array of members denied admin privileges (empty if unchanged)
* resetGroupLink        : Boolean (true = change the group link, false = don't change)
* groupLinkState        : String ("enabled", "enabled-with-approval", "disabled") (empty if unchanged)
* addMemberPermission   : String of who may add members ("every-member", "only-admins") (empty if unchanged)
* editDetailsPermission : String of who may edit group details ("every-member", "only-admins") (empty if unchanged)
* avatar                : Filename of avatar picture to be set for group (send the name of an empty file to delete avatar; leave field empty if avatar is unchanged)
* expiration            : Expiration time for messages sent to this group (in seconds). Set to 0 to disable. (empty if unchanged)

Exceptions: AttachmentInvalid, Failure, InvalidNumber, GroupNotFound

updateProfile(name<s>, about<s>, aboutEmoji <s>, avatar<s>, remove<b>) -> <>::
updateProfile(givenName<s>, familyName<s>, about<s>, aboutEmoji <s>, avatar<s>, remove<b>) -> <>::
* name        : Name for your own profile (empty if unchanged)
* givenName   : Given name for your own profile (empty if unchanged)
* familyName  : Family name for your own profile (empty if unchanged)
* about       : About message for profile (empty if unchanged)
* aboutEmoji  : Emoji for profile (empty if unchanged)
* avatar      : Filename of avatar picture for profile (empty if unchanged)
* remove      : Set to true if the existing avatar picture should be removed

Exceptions: Failure

setContactBlocked(number<s>, block<b>) -> <>::
* number  : Phone number affected by method
* block   : false=remove block, true=block contact

Messages from blocked numbers will no longer be forwarded via DBus.

Exceptions: InvalidNumber

setGroupBlocked(groupId<ay>, block<b>) -> <>::
setGroupBlocked(base64GroupId<s>, block<b>) -> <>::
* groupId       : Byte array representing the internal group identifier
* base64GroupId : String representing the internal group identifier in Base64 format
* block         : false=remove block , true=block contact

Messages from blocked groups will no longer be forwarded via DBus.

Exceptions: GroupNotFound

joinGroup(inviteUri<s>) -> <>::
* inviteUri : String starting with https://signal.group which is generated when you share a group link via Signal App

Exceptions: Failure

quitGroup(groupId<ay>) -> <>::
quitGroup(base64GroupId<s>) -> <>::
* groupId       : Byte array representing the internal group identifier
* base64GroupId : String representing the internal group identifier in Base64 format

Note that quitting a group will not remove the group from the getGroupIds command, but set it inactive which can be tested with isMember()

Exceptions: GroupNotFound, Failure

sendEndSessionMessage(recipients<as>) -> <>::
* recipients : String array of phone numbers

Exceptions: Failure, InvalidNumber, UntrustedIdentity

sendGroupMessage(message<s>, attachments<as>, groupId<ay>) -> timestamp<x>::
sendGroupMessage(message<s>, attachments<as>, base64GroupId<s>) -> timestamp<x>::
* message       : Text to send (can be UTF8)
* attachments   : String array of filenames or URLs to send as attachments
* groupId       : Byte array representing the internal group identifier
* base64GroupId : String representing the internal group identifier in Base64 format
* timestamp     : Can be used to identify the corresponding signal reply

Exceptions: GroupNotFound, Failure, AttachmentInvalid

sendNoteToSelfMessage(message<s>, attachments<as>) -> timestamp<x>::
* message     : Text to send (can be UTF8)
* attachments : String array of filenames or URLs to send as attachments
* timestamp   : Can be used to identify the corresponding signal reply

Exceptions: Failure, AttachmentInvalid

sendMessage(message<s>, attachments<as>, recipient<s>) -> timestamp<x>::
sendMessage(message<s>, attachments<as>, recipients<as>) -> timestamp<x>::
* message     : Text to send (can be UTF8)
* attachments : String array of filenames or URLs to send as attachments
* recipient   : Phone number of a single recipient represented as string
* recipients  : String array of phone numbers
* timestamp   : Can be used to identify the corresponding signal reply

Depending on the type of the recipient field this sends a message to one or multiple recipients.

Exceptions: AttachmentInvalid, Failure, InvalidNumber, UntrustedIdentity

sendGroupMessageReaction(emoji<s>, remove<b>, targetAuthor<s>, targetSentTimestamp<x>, groupId<ay>) -> timestamp<x>::
sendGroupMessageReaction(emoji<s>, remove<b>, targetAuthor<s>, targetSentTimestamp<x>, base64GroupId<s>) -> timestamp<x>::
* emoji               : Unicode grapheme cluster of the emoji
* remove              : Boolean, whether a previously sent reaction (emoji) should be removed
* targetAuthor        : String with the phone number of the author of the message to which to react
* targetSentTimestamp : Long representing timestamp of the message to which to react
* groupId             : Byte array with base64 encoded group identifier
* base64GroupId       : String representing the internal group identifier in Base64 format
* timestamp           : Long, can be used to identify the corresponding signal reply

Exceptions: Failure, InvalidNumber, GroupNotFound

sendMessageReaction(emoji<s>, remove<b>, targetAuthor<s>, targetSentTimestamp<x>, recipient<s>) -> timestamp<x>::
sendMessageReaction(emoji<s>, remove<b>, targetAuthor<s>, targetSentTimestamp<x>, recipients<as>) -> timestamp<x>::
* emoji               : Unicode grapheme cluster of the emoji
* remove              : Boolean, whether a previously sent reaction (emoji) should be removed
* targetAuthor        : String with the phone number of the author of the message to which to react
* targetSentTimestamp : Long representing timestamp of the message to which to react
* recipient           : String with the phone number of a single recipient
* recipients          : Array of strings with phone numbers, should there be more recipients
* timestamp           : Long, can be used to identify the corresponding signal reply

Depending on the type of the recipient(s) field this sends a reaction to one or multiple recipients.

Exceptions: Failure, InvalidNumber

sendGroupRemoteDeleteMessage(targetSentTimestamp<x>, groupId<ay>) -> timestamp<x>::
sendGroupRemoteDeleteMessage(targetSentTimestamp<x>, base64GroupId<s>) -> timestamp<x>::
* targetSentTimestamp : Long representing timestamp of the message to delete
* groupId             : Byte array representing the internal group identifier
* base64GroupId       : String representing the internal group identifier in Base64 format
* timestamp           : Long, can be used to identify the corresponding signal reply

Exceptions: Failure, GroupNotFound

sendRemoteDeleteMessage(targetSentTimestamp<x>, recipient<s>) -> timestamp<x>::
sendRemoteDeleteMessage(targetSentTimestamp<x>, recipients<as>) -> timestamp<x>::
* targetSentTimestamp : Long representing timestamp of the message to delete
* recipient           : String with the phone number of a single recipient
* recipients          : Array of strings with phone numbers, should there be more recipients
* timestamp           : Long, can be used to identify the corresponding signal reply

Depending on the type of the recipient(s) field this deletes a message with one or multiple recipients.

Exceptions: Failure, InvalidNumber

sendContacts() -> <>::

Sends a synchronization message with the local contacts list to all linked devices.

Exceptions: Failure, UntrustedIdentity

sendSyncRequest() -> <>::

Sends a synchronization request to the primary device (for group, contacts, ...). Only works if a secondary device is running the daemon.

Exception: Failure

trust(number<s>, safetyNumber<s>) -> <>::
* number       : Phone number
* safetyNumber : Verify the safety number associated with the phone number.

Exceptions: Failure, InvalidNumber

sendTyping(typingAction<b>, base64GroupId<s>, recipients<as>) -> <>::
* typingAction  : true = start typing, false = stop typing
* base64GroupId : String representing the internal group identifier in Base64 format
* recipients    : List of phone numbers

Note that you must specify either the base64GroupId or the list of recipients, but not both.

Exceptions: Failure, UntrustedIdentity

getContactName(number<s>) -> name<s>::
* number  : Phone number
* name    : Contact's name in local storage (from the primary device for a linked account, or the one set with setContactName); if not set, contact's profile name is used

Exception: InvalidNumber

setContactName(number<s>,name<>) -> <>::
* number  : Phone number
* name    : Name to be set in contacts (in local storage with signal-cli)

Exception: InvalidNumber

setExpirationTimer(number<s>,expiration<i>) -> <>::
* number     : Phone number
* expiration : Expiration time for messages sent to this number (in seconds). Set to 0 to disable.

Exception: InvalidNumber

getGroupIds() -> groupList<aay>::
getGroupIds(dummy<s>) -> groupList<as>::
dummy           : any string (ignored by method; forces output to be identical with getBase64GroupIds)
groupList       : Array of Byte arrays representing the internal group identifiers
base64GroupList : Array of strings representing the internal group identifiers in Base64 format

All groups known are returned, regardless of their active or blocked status. To query that use isMember() and isGroupBlocked()

Exceptions: None

getBase64GroupIds() -> groupList<as>::
groupList : Array of strings representing the internal group identifiers in Base64 format

All groups known are returned, regardless of their active or blocked status. To query that use isMember() and isGroupBlocked()

Exceptions: None

getGroupName(groupId<ay>) -> groupName<s>::
getGroupName(base64GroupId<s>) -> groupName<s>::
groupName     : The display name of the group
groupId       : Byte array representing the internal group identifier
base64GroupId : String representing the internal group identifier in Base64 format

Exception: Failure if base64GroupId or groupId is malformed; GroupNotFound

isMember(groupId<ay>) -> active<b>::
isMember(base64GroupId<s>) -> active<b>::
isMember(groupId<ay>, members<as>, setMemberStatus<b>) -> memberList<as>::
isMember(base64GroupId<s>, members<as>, setMemberStatus<b>) -> memberList<as>::
* groupId         : Byte array representing the internal group identifier
* base64GroupId   : String representing the internal group identifier in Base64 format
* members         : Phone numbers of users to add to or remove from group
* setMemberStatus : true for add to group members; false for remove from group members
* active          : Boolean representing whether you are a member of the group
* memberList      : List of members after command execution

Exceptions: GroupNotFound, Failure

isAdmin(groupId<ay>) -> admin<b>::
isAdmin(base64GroupId<s>) -> admin<b>::
isAdmin(groupId<ay>, admins<as>, setAdminStatus<b>) -> adminList<as>::
isAdmin(base64GroupId<s>, admins<as>, setAdminStatus<b>) -> adminList<as>::
* groupId        : Byte array representing the internal group identifier
* base64GroupId  : String representing the internal group identifier in Base64 format
* admins         : Phone numbers of users to grant or deny admin status
* setAdminStatus : true for add to group admins; false for remove from group admins
* admin          : Boolean representing whether you are an admin of the group
* adminList      : List of admins after command execution

Exceptions: GroupNotFound, Failure

getGroupMembers(groupId<ay>) -> members<as>::
getGroupMembers(base64GroupId<s>) -> members<as>::
* members       : String array with the phone numbers of all active members of a group
* groupId       : Byte array representing the internal group identifier
* base64GroupId : String representing the internal group identifier in Base64 format

Exception: Failure if base64GroupId or groupId is malformed; GroupNotFound

getGroupAdminMembers(groupId<ay>) -> adminMembers<as>::
getGroupAdminMembers(base64GroupId<s>) -> adminMembers<as>::
* groupId       : Byte array representing the internal group identifier
* base64GroupId : String representing the internal group identifier in Base64 format
* adminMembers  : String array of members granted admin privileges

Exception: Failure if base64GroupId or groupId is malformed; GroupNotFound

getGroupPendingMembers(groupId<ay>) -> pendingMembers<as>::
getGroupPendingMembers(base64GroupId<s>) -> pendingMembers<as>::
* groupId        : Byte array representing the internal group identifier
* base64GroupId  : String representing the internal group identifier in Base64 format
* pendingMembers : String array of pending members

Exception: Failure if base64GroupId or groupId is malformed; GroupNotFound

getGroupRequestingMembers(groupId<ay>) -> requestingMembers<as>::
getGroupRequestingMembers(base64GroupId<s>) -> requestingMembers<as>::
* groupId           : Byte array representing the internal group identifier
* base64GroupId     : String representing the internal group identifier in Base64 format
* requestingMembers : String array of requesting members (awaiting admin approval for membership)

Exception: Failure if base64GroupId or groupId is malformed; GroupNotFound

getGroupInviteUri(groupId<ay>) -> inviteUri<s>::
getGroupInviteUri(base64GroupId<s>) -> inviteUri<s>::
* groupId       : Byte array representing the internal group identifier
* base64GroupId : String representing the internal group identifier in Base64 format
* inviteUri     : String starting with https://signal.group which is generated when you share a group link via Signal App

Exceptions: Failure if base64GroupId or groupId is malformed; GroupNotFound

listNumbers() -> numbers<as>::
numbers : String array of all known numbers

This is a concatenated list of all defined contacts as well of profiles known (e.g. peer group members or sender of received messages)

Exceptions: None

getContactNumber(name<s>) -> numbers<as>::
* numbers : Array of phone numbers
* name    : Contact or profile name ("firstname lastname")

Searches contacts and known profiles for a given name and returns the list of all known numbers. May result in e.g. two entries if a contact and profile name is set.

Exception: Failure

isContactBlocked(number<s>) -> state<b>::
* number  : Phone number
* state   : true=blocked, false=not blocked

Exception: InvalidNumber for an incorrectly formatted phone number. For unknown numbers, false is returned, but no exception is raised.

isGroupBlocked(groupId<ay>) -> state<b>::
isGroupBlocked(base64GroupId<s>) -> state<b>::
* groupId       : Byte array representing the internal group identifier
* base64GroupId : String representing the internal group identifier in Base64 format
* state         : true=blocked, false=not blocked

Exceptions: Failure if base64GroupId or groupId is malformed; GroupNotFound

isRegistered(number<s>) -> result<b>::
isRegistered(numbers<as>) -> results<ab>::
* number  : Phone number
* numbers : String array of phone numbers
* result  : true=number is registered, false=number is not registered
* results : Boolean array of results

Exception: InvalidNumber for an incorrectly formatted phone number. For unknown numbers, false is returned, but no exception is raised.

listIdentity(number<s>) -> identities<a(ssss)>::
* number      : Phone number
* identities  : Array of elements, each consisting of four strings: trust_level, date_added, fingerprint, safety_number
** trust_level   : String representation of trust level
** date_added    : String representation of date added
** fingerprint   : String representation of hexidecimal fingerprint
** safety_number : String representation of safety number (10 or 11 space-separated six-digit numbers)

Exception: InvalidNumber

getObjectPath() -> objectPath<s>::
* objectPath  : The DBus object path associated with this connection

Exceptions: None

updateAccount() -> <>::

Updates the account attributes on the Signal server.

Exception: Failure

version() -> version<s>::
* version : Version string of signal-cli

Exceptions: None

link() -> deviceLinkUri<s>::
link(newDeviceName<s>) -> deviceLinkUri<s>::
* newDeviceName : Name to give new device (defaults to "cli" if no name is given)
* deviceLinkUri : URI of newly linked device

Exception: Failure

addDevice(deviceUri<s>) -> <>::
* deviceUri : URI in the form of tsdevice:/?uuid=... Normally received from Signal desktop or smartphone app

Exception: Failure

listDevices() -> devices<as>::
* devices  : String array of linked devices

Exception: Failure

removeDevice(deviceId<i>) -> <>::
* deviceId : Device ID to remove, obtained from listDevices() command

Exception: Failure

register(number<s>, voiceVerification<b>) -> <>::
* number            : Phone number
* voiceVerification : true = use voice verification; false = use SMS verification

Exceptions: Failure, InvalidNumber, RequiresCaptcha

registerWithCaptcha(number<s>, voiceVerification<b>, captcha<s>) -> <>::
* number            : Phone number
* voiceVerification : true = use voice verification; false = use SMS verification
* captcha           : Captcha string

Exceptions: Failure, InvalidNumber, RequiresCaptcha

unregister() -> <>::

Unregisters the current device from the Signal server and kills the daemon.

Exception: Failure

setPin(pin<s>) -> <>::
* pin               : PIN you set after registration (resets after 7 days of inactivity)

Sets a registration lock PIN, to prevent others from registering your number.

Exception: Failure

removePin() -> <>::

Removes registration PIN protection.

Exception: Failure

verify(number<s>, verificationCode<s>) -> <>::
* number            : Phone number
* verificationCode  : Code received from Signal after successful registration request

Command fails if PIN was set after previous registration; use verifyWithPin instead.

Exception: Failure, InvalidNumber

verifyWithPin(number<s>, verificationCode<s>, pin<s>) -> <>::
* number            : Phone number
* verificationCode  : Code received from Signal after successful registration request
* pin               : PIN you set with setPin command after verifying previous registration

Exception: Failure, InvalidNumber

uploadStickerPack(stickerPackPath<s>) -> <>::
* stickerPackPath : Path to the sticker pack zip file or manifest.json file

Exception: Failure

== Signals

SyncMessageReceived (timestamp<x>, sender<s>, destination<s>, groupId<ay>, message<s>, attachments<as>)::
The sync message is received when the user sends a message from a linked device.
* timestamp   : Integer value that is used by the system to send a ReceiptReceived reply
* sender      : Phone number of the sender
* destination : UUID (legacy identifier) of the destination
* groupId     : Byte array representing the internal group identifier (empty when private message)
* message     : Message text
* attachments : String array of filenames for the attachments. These files are located in the signal-cli storage and the current user needs to have read access there

MessageReceived(timestamp<x>, sender<s>, groupId<ay>, message<s>, attachments<as>)::
* timestamp   : Integer value that is used by the system to send a ReceiptReceived reply
* sender      : Phone number of the sender
* groupId     : Byte array representing the internal group identifier (empty when private message)
* message     : Message text
* attachments : String array of filenames for the attachments. These files are located in the signal-cli storage and the current user needs to have read access there

This signal is received whenever we get a private message or a message is posted in a group we are an active member

SyncMessageReceivedV2 (timestamp<x>, sender<s>, destination<s>, groupId<ay>, message<s>, mentions<a(sii)>, attachments<a(sssxibiiss)>)::
* timestamp     : Integer value that is used by the system to send a ReceiptReceived reply
* sender        : Phone number of the sender
* destination   : UUID (legacy identifier) of the destination
* groupId       : Byte array representing the internal group identifier (empty when private message)
* message       : Message text
* mentions      : Struct array of mentions: number, position, length
** number       : String phone number
** position     : Integer starting position of mention within message
** length       : Integer length of mention within message
* attachments   : Struct array of attachment metadata.
** contentType  :  String representing the MIME type of the attachment
** fileName     :  String representing file name if given by the Signal servers
** id           :  String representing remote identifier of attachment. This the name used by signal-cli to store the attachment, and the current user needs to have read access
** size         :  Long representing size of attachment in bytes
** keyLength    :  Integer representing key length
** voiceNote    :  boolean representing whether this attachment is a voice note
** width        :  Integer representation of width in pixels (0 if not image)
** height       :  Integer representation of height in pixels (0 if not image)
** caption      :  String representing photo caption
** blurHash     :  String representing blur hash

The sync message is received when the user sends a message from a linked device.

MessageReceivedV2(timestamp<x>, sender<s>, groupId<ay>, message<s>, mentions<a(sii)>, attachments<a(sssxibiiss)>)::
* timestamp     : Integer value that is used by the system to send a ReceiptReceived reply
* sender        : Phone number of the sender
* groupId       : Byte array representing the internal group identifier (empty when private message)
* message       : Message text
* mentions      : Struct array of mentions: number, position, length
** number       : String phone number
** position     : Integer starting position of mention within message
** length       : Integer length of mention within message
* attachments   : Struct array of attachment metadata.
** contentType  :  String representing the MIME type of the attachment
** fileName     :  String representing file name if given by the Signal servers
** id           :  String representing remote identifier of attachment. This the name used by signal-cli to store the attachment, and the current user needs to have read access
** size         :  Long representing size of attachment in bytes
** keyLength    :  Integer representing key length
** voiceNote    :  boolean representing whether this attachment is a voice note
** width        :  Integer representation of width in pixels (0 if not image)
** height       :  Integer representation of height in pixels (0 if not image)
** caption      :  String representing photo caption
** blurHash     :  String representing blur hash

This signal is received whenever we get a private message or a message is posted in a group we are an active member

ReceiptReceived (timestamp<x>, sender<s>)::
* timestamp : Integer value that can be used to associate this e.g. with a sendMessage()
* sender    : Phone number of the sender

This signal is sent by each recipient (e.g. each group member) after the message was successfully delivered to the device

== Examples

Send a text message (without attachment) to a contact::
dbus-send --print-reply --type=method_call --dest="org.asamk.Signal" /org/asamk/Signal org.asamk.Signal.sendMessage string:"Message text goes here" array:string: string:+123456789

Send a group message::
dbus-send --session --print-reply --type=method_call --dest=org.asamk.Signal /org/asamk/Signal org.asamk.Signal.sendGroupMessage  string:'The message goes here'  array:string:'/path/to/attachmnt1','/path/to/attachmnt2'  array:byte:139,22,72,247,116,32,170,104,205,164,207,21,248,77,185

Print the group name corresponding to a groupId; the daemon runs on system bus, and was started without an explicit `-u USERNAME`::
dbus-send --system --print-reply --type=method_call --dest='org.asamk.Signal' /org/asamk/Signal/_1234567890 org.asamk.Signal.getGroupName array:byte:139,22,72,247,116,32,170,104,205,164,207,21,248,77,185

== Authors

Maintained by AsamK <asamk@gmx.de>, who is assisted by other open source contributors.
For more information about signal-cli development, see
<https://github.com/AsamK/signal-cli>.
