Reusable Python library and CLI for sending text and images via signal-cli-rest-api. Supports both individuals (phone numbers) and groups.
Project description
signal-cli
A reusable Python library and CLI for sending text messages and images via signal-cli-rest-api.
It supports sending to both Signal groups and individual phone numbers, and can discover groups your linked account is a member of.
Installation
pip install signal-cli-py
For CLI usage via isolated environment (recommended):
pipx install signal-cli-py
Note: After installing, the command is still
signal-cli(notsignal-cli-py).
Example:signal-cli send --recipient team "Hello"This is intentional — the PyPI package name is
signal-cli-pyto avoid a naming conflict with an older package.
Quick Start
As a Library
from signal_cli import SignalClient, SignalConfig
# Load from default config (~/.signal-cli/config.json)
client = SignalClient()
# Send to a saved recipient (group or phone number)
client.send("Hello from Python", recipient="team-updates")
# Send with an image
client.send(
"Weekly report",
recipient="+46700000001",
attachments=[{"filename": "report.png", "data": base64_data}]
)
# Discover live groups from your linked account
groups = client.list_remote_groups()
for g in groups:
print(g["name"], g["id"])
As a CLI
# Basic setup (stores number + API URL)
signal-cli setup
# List groups your linked account can see
signal-cli group-list --available
# Send a message
signal-cli send --recipient team-updates "Hello team"
# Send with image
signal-cli send --recipient team-updates --image ./chart.png "Weekly update"
Configuration
By default, configuration is stored at ~/.signal-cli/config.json.
You can override the config location in two ways:
# Explicit path
cfg = SignalConfig(config_path="/path/to/my-signal.json")
client = SignalClient(config=cfg)
# Via environment variable
export SIGNAL_CLI_CONFIG=/path/to/my-signal.json
Important: Linked Device Behavior
This tool is designed to be used as a linked device (not a primary registration).
- New groups created on your phone may not immediately appear when calling
list_remote_groups()orgroup-list --available. - Common triggers that make new groups visible:
- Send/receive a message inside the group from your phone
- Restart the
signal-cli-rest-apicontainer - Re-link the device (most reliable)
If a group is missing, the recommended first step is to send a message in it from your phone and then re-check.
Docker Requirement
Sending requires a running signal-cli-rest-api container (usually managed via Docker Compose).
The recommended compose file is automatically installed to ~/.signal-cli/docker-compose.yml
when you run signal-cli setup (or you can manage it yourself).
This package defaults to MODE=json-rpc in the generated compose file (long-lived
JVM daemon) for the best performance and resource characteristics in normal use.
The link command automatically starts a short-lived container using MODE=native
(the most reliable configuration for device linking) when it detects the standard
local compose file. Your normal service is left exactly as you configured it and is
restarted after linking. You should not need to edit the compose file for linking.
Development
cd signal-cli
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file signal_cli_py-0.5.1.tar.gz.
File metadata
- Download URL: signal_cli_py-0.5.1.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ea4b08c9a25d7737cd7b406f45224e8d75782fe2517af26d57a77ee18c4aae3
|
|
| MD5 |
7f966043c47fd32c4f8e063328a5005d
|
|
| BLAKE2b-256 |
9db9b0160f8a15b25132f4d064ca9177f87c7f0f8f7cccf35d8d4d89ff345a98
|
Provenance
The following attestation bundles were made for signal_cli_py-0.5.1.tar.gz:
Publisher:
publish.yml on jower999/signal-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
signal_cli_py-0.5.1.tar.gz -
Subject digest:
3ea4b08c9a25d7737cd7b406f45224e8d75782fe2517af26d57a77ee18c4aae3 - Sigstore transparency entry: 1582054577
- Sigstore integration time:
-
Permalink:
jower999/signal-cli@e9ab0d837350d9baa4338ac368b327d0f66084dd -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/jower999
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e9ab0d837350d9baa4338ac368b327d0f66084dd -
Trigger Event:
release
-
Statement type:
File details
Details for the file signal_cli_py-0.5.1-py3-none-any.whl.
File metadata
- Download URL: signal_cli_py-0.5.1-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8da3531ee1b85c3db522dab91b80a0f2f93bf74b83c5761446b1433c7dc2494e
|
|
| MD5 |
e117018ab0fb3649358aee06aa007a10
|
|
| BLAKE2b-256 |
a3c310a6dd9ef3132a47ac84bb8d76c3eacd12d5cd596af92cb9e3b17ff9df3c
|
Provenance
The following attestation bundles were made for signal_cli_py-0.5.1-py3-none-any.whl:
Publisher:
publish.yml on jower999/signal-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
signal_cli_py-0.5.1-py3-none-any.whl -
Subject digest:
8da3531ee1b85c3db522dab91b80a0f2f93bf74b83c5761446b1433c7dc2494e - Sigstore transparency entry: 1582054666
- Sigstore integration time:
-
Permalink:
jower999/signal-cli@e9ab0d837350d9baa4338ac368b327d0f66084dd -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/jower999
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e9ab0d837350d9baa4338ac368b327d0f66084dd -
Trigger Event:
release
-
Statement type: