Skip to main content

Asynchronous Python wrapper for the Signal CLI REST API

Project description

Signal Messenger Python API

Disclaimer: This project was generated with the assistance of Claude 3.7 Sonnet based on the Signal CLI REST API Swagger documentation.

Signal Messenger Python API Logo

PyPI version License: MIT GitHub stars GitHub forks GitHub issues Wiki

An asynchronous Python wrapper for the Signal CLI REST API.

Features

  • Fully async implementation using aiohttp
  • Type hints and dataclasses for better IDE support
  • Comprehensive error handling
  • Modular design with separate modules for different API endpoints
  • Extensive test coverage

Modules

Implemented

  • General - Basic API information and configuration

    • Get API information
    • Get/set API configuration
    • Get/set account settings
    • Health check
  • Devices - Register and link devices

    • Get linked devices
    • Link a device
    • Get QR code link for device linking
    • Register a device
    • Verify a device
  • Accounts - Manage Signal accounts

    • Register an account
    • Verify an account
    • Get account details
    • Update an account
    • Set/remove account PIN
    • Delete an account
  • Groups - Create and manage Signal groups

    • Get groups
    • Create a group
    • Update a group
    • Delete a group
    • Add/remove members
    • Join/leave a group
  • Messages - Send and receive messages

    • Send messages
    • Get messages
    • Delete messages
    • Send typing indicators
    • Send read/viewed/delivery receipts
  • Attachments - Handle file attachments

    • Upload attachments
    • Get attachments
    • Delete attachments
    • Get attachment info
  • Profiles - Manage user profiles

    • Get/update profiles
    • Get contact profiles
    • Set profile sharing
  • Identities - Handle Signal identities

    • Get identities
    • Trust/verify identities
    • Reset identity sessions
  • Reactions - Message reactions

    • Send reactions
    • Get reactions
    • Delete reactions
  • Receipts - Message receipts

    • Get receipts
    • Send read/viewed/delivery receipts
  • Search - Search functionality

    • Search messages
    • Search contacts
    • Search groups
    • Search all
  • Stickers - Sticker packs

    • Get sticker packs
    • Install/uninstall sticker packs
    • Upload sticker packs
  • Contacts - Contact management

    • Get contacts
    • Add/update/delete contacts
    • Block/unblock contacts

Installation

pip install signal-messenger-python-api

Prerequisites

Before using this library, you need to have the Signal CLI REST API server running. You can use the Docker image provided by the Signal CLI REST API project:

docker run -p 9922:8080 -v ~/.signal-cli:/home/.signal-cli bbernhard/signal-cli-rest-api

Or using docker-compose:

signal:
    image: bbernhard/signal-cli-rest-api:latest
    container_name: signal-cli-rest-api
    ports:
      - 9922:8080

For more information, see the Signal CLI REST API documentation.

Usage

Basic Usage

import asyncio
from signal_messenger import SignalClient

async def main():
    # Initialize the client with the API base URL
    async with SignalClient("http://localhost:9922") as client:
        # Initialize modules
        await client._init_modules()
        
        # Get API information
        about = await client.get_about()
        print(f"API Version: {about.version}")
        
        # Get API configuration
        config = await client.get_configuration()
        print(f"Logging level: {config.logging.level}")

asyncio.run(main())

Development

Setup

# Clone the repository
git clone https://github.com/pcko1/signal-messenger-python-api.git
cd signal-messenger-python-api

# Install dependencies
pip install -e ".[dev]"

Running Tests

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_messenger_python_api-0.1.0.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

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

signal_messenger_python_api-0.1.0-py3-none-any.whl (50.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for signal_messenger_python_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eee300dac981a601aebca440493d834d70b6d46d9476d1c2f30a248b8f10efc9
MD5 1324297c9cfa5c9aea60fcfeb9f3350b
BLAKE2b-256 8f119e87a6f1504d26c94bf032a600fc4f9432986b4be0b217457d8b6d7c8f20

See more details on using hashes here.

File details

Details for the file signal_messenger_python_api-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for signal_messenger_python_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0bcc3c462347a906de153c628158feb96f11346752c274b3a4391bd0e6c791be
MD5 bbc6f782b2daa1b400380b12575a8107
BLAKE2b-256 fb773158e987491a15fadfae7cc56f56669bf36c0ac74a739bee356af8e99a23

See more details on using hashes here.

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