Skip to main content

Signal messaging library for Python using Presage (Rust)

Project description

ReplyFast

Signal messaging library for Python using Presage (Rust).

Installation

uv pip install replyfast

Quick Start

from replyfast import SignalClient

# Create client
client = SignalClient("./data")

# Link as secondary device (first time only)
def on_url(url):
    print(f"Scan this QR code with Signal app: {url}")

client.link_device_sync("MyDevice", on_url)

# Send a message
client.send_message_sync("recipient-uuid", "Hello!")

# Or find contact by phone/name first
contact = client.find_contact_by_phone_sync("+1234567890")
if contact:
    client.send_message_sync(contact.uuid, "Hello!")

# Receive messages
def on_message(msg):
    if msg.is_queue_empty:
        print("Initial sync complete")
        return True

    print(f"From: {msg.sender}, Body: {msg.body}")
    return True  # Return True to continue, False to stop

client.receive_messages_sync(on_message)

API Reference

SignalClient

Method Description
is_registered_sync() Check if device is linked
link_device_sync(name, callback) Link as secondary device
send_message_sync(uuid, message) Send message to contact
send_group_message_sync(group_id, message) Send message to group
receive_messages_sync(callback) Receive messages with callback
get_contacts_sync() List synced contacts
get_groups_sync() List groups
find_contact_by_phone_sync(phone) Find contact by phone number
find_contacts_by_name_sync(name) Find contacts by name
whoami_sync() Get account info

Message

Field Type Description
sender str Sender's UUID
body str | None Message text
timestamp int Unix timestamp (ms)
group_id str | None Group ID if group message
is_read_receipt bool Is read receipt
is_typing_indicator bool Is typing indicator
is_queue_empty bool Initial sync complete marker

Scheduler

Send messages at scheduled times using cron syntax:

from replyfast import SignalClient, Scheduler

client = SignalClient("./data")
scheduler = Scheduler()

# Send daily greeting at 9:00 AM
def send_greeting():
    contact = client.find_contact_by_phone_sync("+1234567890")
    if contact:
        client.send_message_sync(contact.uuid, "Good morning!")

scheduler.register(
    "0 9 * * *",  # cron: minute hour day month weekday
    send_greeting,
    name="morning-greeting"
)

# With arguments
scheduler.register(
    "0 10 * * 1",  # Every Monday at 10 AM
    client.send_message_sync,
    args=("uuid-here", "Weekly reminder!"),
    name="weekly-reminder"
)

# Run scheduler (blocking)
scheduler.run()

# Or run in background
scheduler.start()
# ... do other things ...
scheduler.stop()

Cron Expression Format

┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12)
│ │ │ │ ┌───────────── day of week (0-6, 0=Sunday)
│ │ │ │ │
* * * * *

Examples:

  • */5 * * * * - Every 5 minutes
  • 0 9 * * * - Every day at 9:00 AM
  • 0 9 * * 1-5 - Weekdays at 9:00 AM
  • 30 */2 * * * - Every 2 hours at minute 30

Decorator Syntax

from replyfast import schedule, get_scheduler

@schedule("0 9 * * *")
def daily_task():
    print("Runs every day at 9 AM")

get_scheduler().start()

Installation

uv pip install replyfast

# With optional dependencies
uv pip install replyfast[scheduler]  # For cron scheduling
uv pip install replyfast[qrcode]     # For QR code display
uv pip install replyfast[all]        # Everything

Requirements

  • Python 3.10+
  • Rust toolchain (for building from source)

License

BSD-2-Clause

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

replyfast-0.1.0.tar.gz (53.1 kB view details)

Uploaded Source

Built Distributions

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

replyfast-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

replyfast-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

replyfast-0.1.0-cp310-abi3-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

replyfast-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file replyfast-0.1.0.tar.gz.

File metadata

  • Download URL: replyfast-0.1.0.tar.gz
  • Upload date:
  • Size: 53.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for replyfast-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e7dde0ee58cf6213612257ceb36b6ccbe4e152ded1990c1c82215ea8287fb696
MD5 35e21233c3ad730e4dfa41343eb64b18
BLAKE2b-256 420d12da7672780b7616fc439b8b2c6776fe0a90195fe9fb320d4ec7264a695b

See more details on using hashes here.

Provenance

The following attestation bundles were made for replyfast-0.1.0.tar.gz:

Publisher: release.yml on kushaldas/replyfast

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

File details

Details for the file replyfast-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for replyfast-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ce82bde27865a2f027eba2c4f179dd62d8a1fb024c14794e026e055eec928e92
MD5 81629f042fc842b5d915a40ed471acc9
BLAKE2b-256 ae8f50911a9b2be4852e2e85b1cce1041da5551603e19a77357dd0c25865b27b

See more details on using hashes here.

Provenance

The following attestation bundles were made for replyfast-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on kushaldas/replyfast

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

File details

Details for the file replyfast-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for replyfast-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c40dac2feebd6c22a9e377fda9b29c7e8132f0c15e0dcc7443540a387a5ab282
MD5 cdfcd991a2de09d333cefca2ccd694f3
BLAKE2b-256 b1d2de5dc74608076f5f0c93be6a01a8ce62eb26415016c121ba8c218f22a3fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for replyfast-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on kushaldas/replyfast

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

File details

Details for the file replyfast-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for replyfast-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f18cd4ad0f532a39b0899b28acdad7ada6d8e663f6554b211745a2c4250bfe42
MD5 32bc11e8916446b608bd6f9727ef05a5
BLAKE2b-256 cdd29b15e27f3d66cb3fdef0328ed50d29f43417229bd21e56cea2f5a6ac6f25

See more details on using hashes here.

Provenance

The following attestation bundles were made for replyfast-0.1.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on kushaldas/replyfast

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

File details

Details for the file replyfast-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for replyfast-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4c2a8018c6abd30fb2dfd6c89f35dcb6c817f91fd3c4207f1066c14b4d38f519
MD5 4550156ea84449dfe3089a26ce53c13c
BLAKE2b-256 370608e97deb0276e653ae6c05ef6ee8aaaeefe9fedbb26076bcd1a823b746af

See more details on using hashes here.

Provenance

The following attestation bundles were made for replyfast-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on kushaldas/replyfast

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