### Install and Start DBus on MacOS Source: https://github.com/asamk/signal-cli/wiki/DBus-service These commands are used on MacOS to install the DBus package using Homebrew and start the DBus service. ```shell brew install dbus ``` ```shell brew services start dbus ``` -------------------------------- ### ICE Server Configuration Example Source: https://github.com/asamk/signal-cli/blob/master/docs/CALL_TUNNEL.md Example of the JSON format for configuring ICE servers. Ensure all URLs, usernames, and passwords are correctly specified. ```json { "urls": [ "turn:example.com" ], "username": "u", "password": "p" } ``` -------------------------------- ### Install signal-cli Distribution Source: https://github.com/asamk/signal-cli/wiki/Provide-native-lib-for-libsignal After compiling the native library, use this command to install the signal-cli distribution. The executable script will be located in the specified path. ```bash $ ./gradlew -Plibsignal_client_path="/PATH/TO/libsignal-client/java/client/build/libs/libsignal-client-0.15.0.jar" installDist ``` -------------------------------- ### Get All Configuration Properties Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Retrieves all configuration properties. Replace `--session` with `--system` if needed. ```bash dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.GetAll string:org.asamk.Signal.Configuration ``` -------------------------------- ### Start Account Linking Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc Initiates the provisioning for a new linked account. Responds with a URI for `addDevice` or QR-code scanning. The URI is time-sensitive. ```json {"jsonrpc":"2.0","method":"startLink","id":"5"} ``` -------------------------------- ### Get Configuration Property Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Retrieves a specific configuration property. Replace `--session` with `--system` if needed. ```bash dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.Get string:org.asamk.Signal.Configuration string:$PROPERTY_NAME ``` -------------------------------- ### Install signal-cli JVM build on Linux Source: https://github.com/asamk/signal-cli/blob/master/README.md Installs the latest JVM build of signal-cli system-wide on Linux. It downloads the tarball, extracts it to /opt, and creates a symbolic link for the executable. ```sh VERSION=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/AsamK/signal-cli/releases/latest | sed -e 's/^.*\/v//') curl -L -O https://github.com/AsamK/signal-cli/releases/download/v"${VERSION}"/signal-cli-"${VERSION}".tar.gz sudo tar xf signal-cli-"${VERSION}".tar.gz -C /opt sudo ln -sf /opt/signal-cli-"${VERSION}"/bin/signal-cli /usr/local/bin/ ``` -------------------------------- ### Manage Sticker Packs Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli.1.adoc List installed sticker packs or add a new one using its URI. ```bash signal-cli listStickerPacks ``` ```bash signal-cli addStickerPack --uri "https://signal.art/addstickers/#pack_id=XXX&pack_key=XXX" ``` -------------------------------- ### startLink Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc Starts the provisioning for a new linked account. Responds with a URI that can be used with the `addDevice` signal-cli command or encoded as a QR-code and scanned with a mobile phone. The URI is only valid for a short amount of time. ```APIDOC ## startLink ### Description Starts the provisioning for a new linked account. Responds with a URI that can be used with the `addDevice` signal-cli command or encoded as a QR-code and scanned with a mobile phone. The URI is only valid for a short amount of time. ### Method `startLink` (JSON-RPC method) ### Request Example ```json { "jsonrpc": "2.0", "method": "startLink", "id": "5" } ``` ### Response Example ```json { "jsonrpc": "2.0", "result": { "deviceLinkUri": "sgnl://linkdevice?uuid=X&pub_key=X" }, "id": "5" } ``` ``` -------------------------------- ### Compile and Run signal-cli with Arguments Source: https://github.com/asamk/signal-cli/blob/master/README.md Compile and run the signal-cli application using Gradle, passing command-line arguments. This example shows how to display help information. ```bash ./gradlew run --args="--help" ``` -------------------------------- ### Install signal-cli GraalVM native build on Linux Source: https://github.com/asamk/signal-cli/blob/master/README.md Installs the latest GraalVM native build of signal-cli system-wide on Linux. It downloads the native tarball, extracts it to /opt, and creates a symbolic link for the executable. ```sh VERSION=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/AsamK/signal-cli/releases/latest | sed -e 's/^.*\/v//') curl -L -O https://github.com/AsamK/signal-cli/releases/download/v"${VERSION}"/signal-cli-"${VERSION}"-Linux-native.tar.gz sudo tar xf signal-cli-"${VERSION}"-Linux-native.tar.gz -C /opt sudo ln -sf /opt/signal-cli /usr/local/bin/ ``` -------------------------------- ### Create Custom DBus Directory and Start Daemon on MacOS Source: https://github.com/asamk/signal-cli/wiki/DBus-service If DBus is not running, this sequence creates a custom directory for the DBus socket, sets permissions, defines the socket path, and starts the DBus daemon manually. This is an alternative for when the system DBus is unavailable. ```shell mkdir -p $HOME/Library/Caches/dbus ``` ```shell chmod 0700 $HOME/Library/Caches/dbus ``` ```shell DBUS_LAUNCHD_SESSION_BUS_SOCKET=$HOME/Library/Caches/dbus/bus ``` ```shell /usr/local/Cellar/dbus/1.12.20/bin/dbus-daemon --nofork --session --address=unix:path=$DBUS_LAUNCHD_SESSION_BUS_SOCKET ``` -------------------------------- ### Get All Device Properties Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Retrieves all properties of a Signal device. Replace `--session` with `--system` if needed. ```bash dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.GetAll string:org.asamk.Signal.Device ``` -------------------------------- ### JSON-RPC Request: List Groups (Multi-Account) Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc Example of a JSON-RPC request to list groups in multi-account mode, specifying the target account. ```json {"jsonrpc":"2.0","method":"listGroups","id":"my special mark","params":{"account":"+33123456789"}} ``` -------------------------------- ### Get All Group Properties via D-Bus Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Shows how to fetch all properties of a Signal group at once using `dbus-send` and the `org.freedesktop.DBus.Properties.GetAll` interface. ```bash dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.GetAll string:org.asamk.Signal.Group ``` -------------------------------- ### Initiate Device Linking Source: https://github.com/asamk/signal-cli/wiki/Linking-other-devices-(Provisioning) Use this command to start the process of linking a new device. It generates a link that can be used to connect to another signal-cli instance or scanned by a mobile app. Do not terminate the process until linking is complete. ```shell signal-cli link -n "optional device name" ``` -------------------------------- ### JSON-RPC Response: List Groups Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc Example JSON-RPC response for the 'listGroups' method, detailing group information. ```json {"jsonrpc":"2.0","result":[{"id":"Pmpi+EfPWmsxiomLe9Nx2XF9HOE483p6iKiFj65iMwI=","name":"My Group","description":"It's special because it is mine.","isMember":true,"isBlocked":false,"members":["+33123456789","+440123456789"],"pendingMembers":[],"requestingMembers":[],"admins":["+33123456789","+440123456789"],"groupInviteLink":"https://signal.group/#CjQKIAtcbUw482i7bqvmJCwdgvg0FMif52N5v9lGg_bE4U3zEhCjHKSaPzWImMpnCbU8A1r0"}],"id":"my special mark"} ``` -------------------------------- ### Invalid Request - Missing Method Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc An example of an invalid JSON-RPC request where the 'method' field is not set. ```json {"jsonrpc":"2.0"} ``` -------------------------------- ### Get Device Property Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Retrieves a specific property of a Signal device. Replace `--session` with `--system` if needed. ```bash dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.Get string:org.asamk.Signal.Device string:$PROPERTY_NAME ``` -------------------------------- ### Configure DBus System Service on Linux Source: https://github.com/asamk/signal-cli/wiki/DBus-service These commands copy configuration and service files to their respective system directories and reload system services. This setup is for running signal-cli on the system bus with systemd. ```shell cp data/org.asamk.Signal.conf /etc/dbus-1/system.d/ ``` ```shell cp data/org.asamk.Signal.service /usr/share/dbus-1/system-services/ ``` ```shell cp data/signal-cli.service /etc/systemd/system/ ``` ```shell sed -i -e "s|%dir%||" /etc/systemd/system/signal-cli.service ``` ```shell systemctl daemon-reload ``` ```shell systemctl enable signal-cli.service ``` ```shell systemctl reload dbus.service ``` -------------------------------- ### Configure DBus System Service on MacOS Source: https://github.com/asamk/signal-cli/wiki/DBus-service This command copies the DBus configuration file to the system directory on MacOS, which is the equivalent of the systemd setup for Linux. ```shell cp data/org.asamk.Signal.conf /usr/local/etc/dbus-1/system.d/ ``` -------------------------------- ### JSON-RPC Response: Subscribe to Receive Messages Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc Example response after subscribing to receive messages, returning a subscription ID. ```json {"jsonrpc":"2.0","result":0,"id":"id"} ``` -------------------------------- ### Start Outgoing Call (JSON-RPC) Source: https://github.com/asamk/signal-cli/blob/master/docs/CALL_TUNNEL.md Initiates an outgoing call to a specified recipient. Requires `subscribeCallEvents` to be called first. ```jsonrpc startCall(recipient) ``` -------------------------------- ### Run signal-cli in Daemon Mode Source: https://github.com/asamk/signal-cli/wiki/DBus-service Use this command to start signal-cli in daemon mode, making its DBus interface available on the session bus. Specify an account with the -a flag if needed. ```shell signal-cli [-a ACCOUNT] daemon --dbus ``` -------------------------------- ### JSON-RPC Notification: Incoming Message (Manual Subscription) Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc Example of an incoming message received via a manual subscription, wrapped in a subscription response object. ```json {"jsonrpc":"2.0","method":"receive","params":{"subscription":0,"result":{"envelope":{"source":"+33123456789","sourceNumber":"+33123456789","sourceUuid":"uuid","sourceName":"name","sourceDevice":2,"timestamp":1693064367769,"syncMessage":{"sentMessage":{"destination":"+33123456789","destinationNumber":"+33123456789","destinationUuid":"uuid","timestamp":1693064367769,"message":"j","expiresInSeconds":0,"viewOnce":false}}},"account":"+33123456789"}}} ``` -------------------------------- ### JSON-RPC Request: List Groups Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc Example of a JSON-RPC request to list groups. The 'id' field is used to match responses to requests. ```json {"jsonrpc":"2.0","method":"listGroups","id":"my special mark"} ``` -------------------------------- ### Get Default java.library.path Source: https://github.com/asamk/signal-cli/wiki/Provide-native-lib-for-libsignal Retrieve the system's default Java library path. This is useful for understanding where the Java runtime searches for native libraries. ```bash java -XshowSettings:properties -version 2>&1 | grep java.library.path ``` -------------------------------- ### Run Signal-CLI Daemon on Secondary Machine Source: https://github.com/asamk/signal-cli/wiki/Linking-other-devices-(Provisioning) After linking a secondary signal-cli instance, this command starts it in daemon mode, allowing it to process messages and perform most Signal operations. ```shell signal-cli -u USERNAME daemon ``` -------------------------------- ### Get Group Name by Group ID via D-Bus Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Retrieve the human-readable name of a group using its internal byte array identifier. This command assumes the signal-cli daemon is running on the system bus and was started without an explicit account. ```bash 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 ``` -------------------------------- ### Startup Sequence Source: https://github.com/asamk/signal-cli/blob/master/docs/CALL_TUNNEL.md Diagram illustrating the startup sequence between signal-cli and signal-call-tunnel. ```APIDOC ## Startup Sequence This diagram shows the initial communication flow when starting up. ``` signal-cli signal-call-tunnel | | |-- spawn process ------------------> | |-- config JSON + newline on stdin ---->| | | | | parse config | | initialize audio | | |<-------- ready (on stdout) -----------| | {"type":"ready", | | "inputDeviceName":"...", | | "outputDeviceName":"..."} | | | |-- control messages on stdin --------->| |<-- control events on stdout ----------| ``` ``` -------------------------------- ### sendTyping Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Manages the typing indicator for a recipient, either starting or stopping it. ```APIDOC ## sendTyping(recipient, stop) ### Description Manages the typing indicator for a recipient. Set 'stop' to true to stop the typing indicator. ### Method DBUS ### Parameters #### Path Parameters * **recipient** (string) - Phone number of the recipient * **stop** (boolean) - True to stop the typing state, false otherwise ### Exceptions * Failure * UntrustedIdentity ``` -------------------------------- ### Display QR Code and Open Image File Source: https://github.com/asamk/signal-cli/wiki/Linking-other-devices-(Provisioning) This command generates a QR code image file and then opens it using the default application. It waits for the file to be created before opening. ```shell signal-cli link -n "optional device name" | xargs -L 1 qrencode -o /tmp/qrcode.png & while [ ! -f /tmp/qrcode.png ]; do sleep 1; done; xdg-open /tmp/qrcode.png ``` -------------------------------- ### Signal-cli and Call Tunnel Startup Sequence Source: https://github.com/asamk/signal-cli/blob/master/docs/CALL_TUNNEL.md Illustrates the initial communication handshake between signal-cli and signal-call-tunnel. The tunnel expects configuration JSON on stdin and signals readiness via stdout. ```text signal-cli signal-call-tunnel | | |-- spawn process ------------------> | |-- config JSON + newline on stdin ---->| | | | | parse config | | initialize audio | | |<-------- ready (on stdout) ----------| | {"type":"ready", | | "inputDeviceName":"...", | | "outputDeviceName":"..."} | | | |-- control messages on stdin --------->| |<-- control events on stdout ----------| ``` -------------------------------- ### Set Configuration Property Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Sets a specific configuration property. Replace `--session` with `--system` if needed. ```bash dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.Set string:org.asamk.Signal.Configuration string:$PROPERTY_NAME variant:$PROPERTY_TYPE:$PROPERTY_VALUE ``` -------------------------------- ### Create Fat Jar with Gradle Source: https://github.com/asamk/signal-cli/blob/master/README.md Build a fat JAR file for signal-cli using Gradle. This single JAR file will contain all dependencies. ```bash ./gradlew fatJar ``` -------------------------------- ### Build signal-cli with Gradle Source: https://github.com/asamk/signal-cli/blob/master/README.md Execute the Gradle wrapper to build the signal-cli project. This command compiles the code and prepares the project artifacts. ```bash ./gradlew build ``` -------------------------------- ### JSON-RPC Notification: Incoming Message (Auto-Receive) Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc Example of an incoming message received as a JSON-RPC notification when auto-receiving is enabled. ```json {"jsonrpc":"2.0","method":"receive","params":{"envelope":{"source":"+33123456789","sourceNumber":"+33123456789","sourceUuid":"uuid","sourceName":"name","sourceDevice":1,"timestamp":1631458508784,"dataMessage":{"timestamp":1631458508784,"message":"foobar","expiresInSeconds":0,"viewOnce":false,"mentions":[],"attachments":[],"contacts":[]}}}} ``` -------------------------------- ### Display QR Code with Higher Quality and Open Source: https://github.com/asamk/signal-cli/wiki/Linking-other-devices-(Provisioning) Similar to the previous command, this generates a QR code image file with higher error correction and version settings, then opens it. It also waits for the file to be created. ```shell signal-cli link -n "optional device name" | xargs -L 1 qrencode -o /tmp/qrcode.png --level=H -v 10 & while [ ! -f /tmp/qrcode.png ]; do sleep 1; done; xdg-open /tmp/qrcode.png ``` -------------------------------- ### Receive Contacts and Groups After Linking Source: https://github.com/asamk/signal-cli/wiki/Linking-other-devices-(Provisioning) After successfully linking a device, execute this command to synchronize contacts and group information from the primary device. ```shell signal-cli -u USERNAME receive ``` -------------------------------- ### Get All Identity Properties Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Retrieves all properties of a Signal identity. Replace `--session` with `--system` if needed. ```bash dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.GetAll string:org.asamk.Signal.Identity ``` -------------------------------- ### Deploy Compiled signal-cli Binary Source: https://github.com/asamk/signal-cli/wiki/FAQ Copy the compiled signal-cli binary to the system's executable path and set appropriate permissions. ```bash sudo cp ./build/native/nativeCompile/signal-cli /usr/local/bin/ && sudo chmod 755 /usr/local/bin/signal-cli ``` -------------------------------- ### Create Shell Wrapper with Gradle Source: https://github.com/asamk/signal-cli/blob/master/README.md Use Gradle to create a shell script wrapper for the signal-cli executable. The wrapper will be located in `build/install/signal-cli/bin`. ```bash ./gradlew installDist ``` -------------------------------- ### Get Identity Property Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Retrieves a specific property of a Signal identity. Replace `--session` with `--system` if needed. ```bash dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.Get string:org.asamk.Signal.Identity string:$PROPERTY_NAME ``` -------------------------------- ### Build JNI Library for Desktop Source: https://github.com/asamk/signal-cli/wiki/Provide-native-lib-for-libsignal Navigate to the libsignal-client's java directory and execute this script to build the JNI library for desktop platforms. ```shell $ cd java $ ./build_jni.sh desktop ``` -------------------------------- ### Verify DBus Launchd Session Bus Socket Source: https://github.com/asamk/signal-cli/wiki/DBus-service Use this command to print the value of the DBUS_LAUNCHD_SESSION_BUS_SOCKET environment variable to verify it has been set correctly. ```shell printenv DBUS_LAUNCHD_SESSION_BUS_SOCKET ``` -------------------------------- ### Compile Native Binary with GraalVM Source: https://github.com/asamk/signal-cli/blob/master/README.md Use Gradle to compile a native binary of signal-cli using GraalVM. This is an experimental feature and the binary will be located at `build/native/nativeCompile/signal-cli`. ```bash ./gradlew nativeCompile ``` -------------------------------- ### Create Tar Distribution with Gradle Source: https://github.com/asamk/signal-cli/blob/master/README.md Generate a tar archive of the signal-cli distribution using Gradle. The archive will be found in `build/distributions`. ```bash ./gradlew distTar ``` -------------------------------- ### Get Attachment Data Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli.1.adoc Retrieve the raw data of a specified attachment using its ID. The data is returned as a Base64 encoded string. ```bash signal-cli getAttachment --id ATTACHMENT_ID ``` -------------------------------- ### Finish Account Linking Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc Completes the provisioning of a new linked account. Waits for a response from the primary device. Requires the `deviceLinkUri` from `startLink` and optionally accepts a `deviceName`. ```json {"jsonrpc":"2.0","method":"finishLink","id":"6","params":{"deviceLinkUri":"sgnl://linkdevice?uuid=X&pub_key=X","deviceName":"new-name"}} ``` -------------------------------- ### Get Group Property via D-Bus Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Demonstrates how to retrieve a specific property of a Signal group using the `dbus-send` command with the `org.freedesktop.DBus.Properties.Get` interface. ```bash dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.Get string:org.asamk.Signal.Group string:$PROPERTY_NAME ``` -------------------------------- ### Get Signal account version via DBus Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Retrieves the version string of the signal-cli daemon. This is a simple query to check the running version. ```bash dbus-send --session --dest=org.asamk.Signal --type=method_call --print-reply /org/asamk.Signal org.asamk.Signal.version ``` -------------------------------- ### Set DBUS_SESSION_BUS_ADDRESS for Cron Source: https://github.com/asamk/signal-cli/wiki/DBus-service When running DBus commands via Cron, the `DBUS_SESSION_BUS_ADDRESS` environment variable must be exported. This example shows how to set it for Ubuntu. ```bash export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ``` -------------------------------- ### Add a New Device using a URI Source: https://github.com/asamk/signal-cli/wiki/Linking-other-devices-(Provisioning) This command is used by the primary device to add a new linked device using the provided `sgnl://linkdevice` URI. This URI is obtained from the new signal-cli instance or a QR code. ```shell signal-cli -u USERNAME addDevice --uri "sgnl://linkdevice?…" ``` -------------------------------- ### Signal.Configuration Interface Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Methods and properties for managing Signal's configuration settings. ```APIDOC ## Signal.Configuration Properties ### Description Manages configuration properties for the primary device. ### Properties - ReadReceipts (Boolean) - UnidentifiedDeliveryIndicators (Boolean) - TypingIndicators (Boolean) - LinkPreviews (Boolean) ### Usage To get a property: `dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.Get string:org.asamk.Signal.Configuration string:$PROPERTY_NAME` To set a property: `dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.Set string:org.asamk.Signal.Configuration string:$PROPERTY_NAME variant:$PROPERTY_TYPE:$PROPERTY_VALUE` To get all properties: `dbus-send --session --dest=org.asamk.Signal --print-reply $OBJECT_PATH org.freedesktop.DBus.Properties.GetAll string:org.asamk.Signal.Configuration` ``` -------------------------------- ### Compile signal-cli with GraalVM Source: https://github.com/asamk/signal-cli/wiki/FAQ Initiate the native compilation of signal-cli using the Gradle wrapper. ```bash ./gradlew nativeCompile ``` -------------------------------- ### Signal-cli JSON-RPC Daemon Command Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc Starts the signal-cli daemon to provide a JSON-RPC API over a socket, TCP, or HTTP endpoint. This is suitable for handling requests from multiple clients. ```bash signal-cli daemon --socket ``` ```bash signal-cli daemon --tcp=HOST:PORT ``` ```bash signal-cli daemon --http=HOST:PORT ``` -------------------------------- ### Get self number from Signal DBus interface Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Retrieves the phone number associated with the current Signal account. This is a straightforward query to identify the account's own number. ```bash dbus-send --session --dest=org.asamk.Signal --type=method_call --print-reply /org/asamk.Signal/_441234567890 org.asamk.Signal.getSelfNumber ``` -------------------------------- ### Clone and Verify signal-cli Build Source: https://github.com/asamk/signal-cli/blob/master/reproducible-builds/README.md Clone the signal-cli repository and execute the verification script to confirm build reproducibility. Ensure you replace '0.14.2' with the specific version you are verifying. This process requires git and Docker. ```bash git clone --depth 1 --branch v0.14.2 https://github.com/AsamK/signal-cli cd ./signal-cli ./reproducible-builds/verify.sh ``` -------------------------------- ### Outgoing Call Flow Sequence Source: https://github.com/asamk/signal-cli/blob/master/docs/CALL_TUNNEL.md Details the sequence of events for initiating an outgoing call. This includes call setup, offer/answer exchange, ICE candidate gathering, and connection state changes. ```text signal-cli signal-call-tunnel Remote Phone | | | |-- spawn + config ------->| | |<-- ready ----------------| | |-- createOutgoingCall --->| | |-- proceed (TURN) ------->| | | | create offer | |<-- sendOffer ------------| | |-- offer via Signal -------------------------------->| |<-- answer via Signal -------------------------------| |-- receivedAnswer ------->| (+ identity keys) | |<-- sendIce --------------| | |-- ICE via Signal -------------------------------> | |<-- ICE via Signal -------------------------------- | |-- receivedIce ---------->| | | | ICE connects | |<-- stateChange:Connected | | ``` -------------------------------- ### Signal-call-tunnel Spawning and Configuration Source: https://github.com/asamk/signal-cli/blob/master/docs/CALL_TUNNEL.md Explains the process of spawning the `signal-call-tunnel` subprocess for each voice call and the initial configuration JSON it expects. ```APIDOC ## Spawning the Tunnel For each call, signal-cli: 1. Spawns `signal-call-tunnel` 2. Writes config JSON followed by a newline to stdin 3. Keeps stdin open for subsequent control messages 4. Reads control events from stdout 5. Captures stderr for logging The `signal-call-tunnel` binary is located by searching (in order): 1. `SIGNAL_CALL_TUNNEL_BIN` environment variable 2. `/bin/signal-call-tunnel` (detected from jar location) 3. `signal-call-tunnel` on `PATH` ### Config JSON The first line written to the tunnel's stdin: ```json { "call_id": 12345, "is_outgoing": true, "local_device_id": 1, "input_device_name": "signal_input", "output_device_name": "signal_output" } ``` | Field | Type | Description | |----------------------|-------------------------|-----------------------------------------------| | `call_id` | unsigned 64-bit integer | Call identifier (use unsigned representation) | | `is_outgoing` | boolean | Whether this is an outgoing call | | `local_device_id` | integer | Signal device ID | | `input_device_name` | string (optional) | Requested input audio device name | | `output_device_name` | string (optional) | Requested output audio device name | If `input_device_name` or `output_device_name` are omitted, the tunnel chooses default names. On Linux, these are per-call unique names (e.g., `signal_input_`). On macOS, these are the fixed names `signal_input` and `signal_output`, which must match the pre-installed BlackHole drivers. ``` -------------------------------- ### Display QR Code for Linking (UTF-8) Source: https://github.com/asamk/signal-cli/wiki/Linking-other-devices-(Provisioning) This command pipes the linking output to `qrencode` to display the QR code directly in the terminal using UTF-8 characters. This is useful for linking to mobile devices on Linux systems. ```shell signal-cli link -n "optional device name" | tee >(xargs -L 1 qrencode -t utf8) ``` -------------------------------- ### Receive Messages with Python Source: https://github.com/asamk/signal-cli/wiki/DBus-service Listen for incoming messages from the signal-cli daemon using Python and `pydbus`. The `msgRcv` function handles incoming messages. Ensure `DBUS_SESSION_BUS_ADDRESS` is set if the daemon was started without a username. ```python def msgRcv (timestamp, source, groupID, message, attachments): print ("Message", message, "received in group", signal.getGroupName (groupID)) return from pydbus import SystemBus from gi.repository import GLib bus = SystemBus() loop = GLib.MainLoop() signal = bus.get('org.asamk.Signal') # NOTE: when daemon was started without explicit `-u USERNAME`, replace the line above with # signal = bus.get("org.asamk.Signal", "/org/asamk/Signal/_YOURPHONENUMBER") signal.onMessageReceived = msgRcv loop.run() ``` -------------------------------- ### View All Known Keys Source: https://github.com/asamk/signal-cli/wiki/Manage-trusted-keys Lists all known encryption keys for the specified user. Requires the USERNAME. ```bash signal-cli -u USERNAME listIdentities ``` -------------------------------- ### Get contact number from Signal DBus interface Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Searches for phone numbers associated with a given contact or profile name. It returns an array of all known numbers for that name, potentially including entries from both contacts and profiles. ```bash dbus-send --session --dest=org.asamk.Signal --type=method_call --print-reply /org/asamk.Signal/_441234567890 org.asamk.Signal.getContactNumber string:"John Doe" ``` -------------------------------- ### Monitor System Entropy Source: https://github.com/asamk/signal-cli/wiki/FAQ Use 'watch cat /proc/sys/kernel/random/entropy_avail' to monitor available system entropy. Low entropy can cause signal-cli operations to block. ```bash watch cat /proc/sys/kernel/random/entropy_avail ``` -------------------------------- ### Assemble Client for signal-cli Build Source: https://github.com/asamk/signal-cli/wiki/Provide-native-lib-for-libsignal Run the Gradle assemble task within the libsignal-client's java directory to build the client component, skipping Android builds. This is a prerequisite for using a custom libsignal-client JAR with signal-cli. ```shell # Run in libsignal-client/java folder $ ./gradlew --no-daemon :client:assemble -PskipAndroid=true ``` -------------------------------- ### Get contact name from Signal DBus interface Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Retrieves the contact name associated with a given phone number. The name can be from local storage, the primary device, or a locally set contact name. If none is set, the profile name is used. ```bash dbus-send --session --dest=org.asamk.Signal --type=method_call --print-reply /org/asamk.Signal/_441234567890 org.asamk.Signal.getContactName string:"+1234567890" ``` -------------------------------- ### finishLink Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc Finish provisioning of a new linked account. Can be called immediately after `startLink`, it will wait for a response from the primary device. ```APIDOC ## finishLink ### Description Finish provisioning of a new linked account. Can be called immediately after `startLink`, it will wait for a response from the primary device. ### Method `finishLink` (JSON-RPC method) ### Parameters #### Request Body - **deviceLinkUri** (string) - Required - the URI returned by `startLink` - **deviceName** (string) - Optional - the name for the new linked device ### Request Example ```json { "jsonrpc": "2.0", "method": "finishLink", "id": "6", "params": { "deviceLinkUri": "sgnl://linkdevice?uuid=X&pub_key=X", "deviceName": "new-name" } } ``` ### Response Example ```json { "jsonrpc": "2.0", "result": { "deviceLinkUri": "sgnl://linkdevice?uuid=X&pub_key=X" }, "id": "6" } ``` ``` -------------------------------- ### Set GraalVM Environment Variables Source: https://github.com/asamk/signal-cli/wiki/FAQ Export GraalVM home and Java home directories to use GraalVM for compilation. ```bash export GRAALVM_HOME=/opt/graalvm-jdk-25 ; export JAVA_HOME=/opt/graalvm-jdk-25 ``` -------------------------------- ### Link a new Signal device using DBus Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc This command links a new device to your Signal account via DBus. It requires the `dbus-send` utility and `qrencode` for generating a QR code. The output URI can be scanned by a Signal smartphone client to complete the linking process. ```bash dbus-send --session --dest=org.asamk.Signal --type=method_call --print-reply /org/asamk/Signal org.asamk.Signal.link string:"My secondary client" | tr '\n' '\0' | sed 's/.*string //g' | sed 's/"//g' | qrencode -s10 -tANSI256 ``` -------------------------------- ### Compile Native Library for signal-cli Source: https://github.com/asamk/signal-cli/wiki/Provide-native-lib-for-libsignal Use this Gradle command to compile the native library for signal-cli, specifying the path to the libsignal-client JAR. This is the first step in integrating a custom native library. ```bash $ ./gradlew -Plibsignal_client_path="/PATH/TO/libsignal-client/java/client/build/libs/libsignal-client-0.15.0.jar" nativeCompile ``` -------------------------------- ### Call Reconnection State Machine (JSON-RPC) Source: https://github.com/asamk/signal-cli/blob/master/docs/CALL_TUNNEL.md Illustrates the state transitions during an ICE restart for a connected call. ```text CONNECTED --> RECONNECTING --> CONNECTED (ICE restart succeeded) | v ENDED (ICE restart failed) ``` -------------------------------- ### Build signal-cli with Custom libsignal-client Source: https://github.com/asamk/signal-cli/wiki/Provide-native-lib-for-libsignal Build the signal-cli project, specifying a custom path to a pre-built libsignal-client JAR file. This is useful when using a self-compiled version of the library. ```shell # Run in signal-cli folder $ ./gradlew -Plibsignal_client_path="/PATH/TO/libsignal-client/java/client/build/libs/libsignal-client-0.15.0.jar" build ``` -------------------------------- ### Build GraalVM Native Image for signal-cli Source: https://github.com/asamk/signal-cli/wiki/Provide-native-lib-for-libsignal Build the GraalVM native image for signal-cli, likely using a custom libsignal-client build. ```shell # Run in signal-cli folder $ ./gradlew -Plibsignal_client_path="/PATH/TO/libsignal-client/java/client/build/libs/libsignal-client-0.15.0.jar" buildNativeImage ``` -------------------------------- ### Backup Signal-CLI Account Databases Source: https://github.com/asamk/signal-cli/wiki/Quickstart This bash script backs up Signal-CLI account databases using sqlite3. It finds all account.db files in the specified folder and creates a timestamped backup for each. ```bash find /folder/to/signal-cli/data -type f -name account.db | xargs -L1 -I{} sqlite3 {} ".backup {}.$(date +%Y%m%d%H%M)" ``` -------------------------------- ### Sticker and Version Info Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-dbus.5.adoc Methods for uploading sticker packs and retrieving the signal-cli version. ```APIDOC ## uploadStickerPack(stickerPackPath) ### Description Uploads a sticker pack to Signal. ### Method uploadStickerPack ### Parameters #### Path Parameters - **stickerPackPath** (string) - Required - Path to the manifest.json file or a zip file. ### Returns - **url** (string) - URL of the sticker pack after successful upload. ### Exceptions - Failure ``` ```APIDOC ## version() ### Description Retrieves the current version of signal-cli. ### Method version ### Returns - **version** (string) - The version string of signal-cli. ### Exceptions - None ``` -------------------------------- ### Upload Sticker Pack Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli.1.adoc Upload a new sticker pack. Ensure images conform to the specified format, size, and resolution. The manifest.json file must be correctly formatted. ```json { "title": "", "author": "", "cover": { "file": "", "contentType": "", "emoji": "" }, "stickers": [ { "file": "", "contentType": "", "emoji": "" } ... ] } ``` ```bash signal-cli uploadStickerPack /path/to/manifest.json ``` -------------------------------- ### Execute List Groups JSON-RPC Request via CLI Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc Demonstrates how to pipe a JSON-RPC request to the signal-cli jsonRpc command. ```bash echo '{"jsonrpc":"2.0","method":"listGroups","id":"my special mark"}' | signal-cli -u +33123456789 jsonRpc ``` -------------------------------- ### Clone signal-cli Repository Source: https://github.com/asamk/signal-cli/blob/master/README.md Clone the source code of the signal-cli project from GitHub. This is the first step before building the project. ```bash git clone https://github.com/AsamK/signal-cli.git ``` -------------------------------- ### Run signal-cli daemon command Source: https://github.com/asamk/signal-cli/wiki/JSON-RPC-service The `daemon` command exposes a socket (UNIX or TCP) for handling multiple client requests. Use `--socket` to specify the socket type. Specify the account with `-a _ACCOUNT_` or omit for multi-account mode. ```bash signal-cli -a _ACCOUNT_ daemon --socket ``` ```bash signal-cli daemon --socket ``` -------------------------------- ### Synchronize Contacts and Groups Source: https://github.com/asamk/signal-cli/blob/master/man/signal-cli.1.adoc Send local contact list to all linked devices or request synchronization from the primary device. ```bash signal-cli sendContacts ``` ```bash signal-cli sendSyncRequest ```