Skip to main content

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 (not signal-cli-py).
Example: signal-cli send --recipient team "Hello"

This is intentional — the PyPI package name is signal-cli-py to 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() or group-list --available.
  • Common triggers that make new groups visible:
    • Send/receive a message inside the group from your phone
    • Restart the signal-cli-rest-api container
    • 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 installed to ~/.signal-cli/docker-compose.yml (or you can manage it yourself).

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

signal_cli_py-0.3.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

signal_cli_py-0.3.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file signal_cli_py-0.3.0.tar.gz.

File metadata

  • Download URL: signal_cli_py-0.3.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for signal_cli_py-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6ae9180d2d67afed8959a84ff89b0faef09d429a162dc4e388565787a7cb0a62
MD5 e46fc54e9194d65ee7933c24e7729b74
BLAKE2b-256 e15c75607a3ba0e68ba83855960935f5764469b8be2e7285c3a39ae6a4f104c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for signal_cli_py-0.3.0.tar.gz:

Publisher: publish.yml on jower999/signal-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file signal_cli_py-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: signal_cli_py-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for signal_cli_py-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2e9336aada6c868bdc5ba617c20b4c6f7b397bc940e9fe06db081abd22d7b3d
MD5 2b82e29b9ab56a98fab8e25ff1f2d1d9
BLAKE2b-256 206cc2357a539b90ea443a5276d509dec2ef1324fd4325d5f2592a73bff5835a

See more details on using hashes here.

Provenance

The following attestation bundles were made for signal_cli_py-0.3.0-py3-none-any.whl:

Publisher: publish.yml on jower999/signal-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page