signal-cli-rest-api is a wrapper around signal-cli and allows you to interact with it through http requests

Overview

signal-cli-rest-api

signal-cli-rest-api is a wrapper around signal-cli and allows you to interact with it through http requests.

Features

  • register/verify/unregister a number
  • send messages to multiple users/a group with one or multiple attachments
  • receive messages (with attachments)
  • block/unblock users and groups
  • link to existing device
  • list/create/update/leave groups
  • update profile (name/avatar)

To-Do

  • integrate dbus daemon for faster sending
  • authentication

Installation

pip

If you install signal-cli-rest-api through pip you need to manually install signal-cli on your system.

# by default the app will look for the signal config files in ~/.local/share/signal-cli
# you can change the directory by setting the SIGNAL_CONFIG_PATH env var to the desired path
# e.g. export SIGNAL_CONFIG_PATH=/opt/signal
pip install signal-cli-rest-api
uvicorn signal_cli_rest_api.app.main:app --host 0.0.0.0 --port 8000

Docker

export SIGNAL_DATA_DIR=~/signal/
docker run --name signal --restart unless-stopped -p 8000:8000 -v $SIGNAL_DATA_DIR:/root/.local/share/signal-cli sebastiannoelluebke/signal-cli-rest-api

docker-compose

git clone https://github.com/SebastianLuebke/signal-cli-rest-api.git
cd signal-cli-rest-api
# docker-compose build
docker-compose up -d

Security Notice

signal-cli-rest-api doesn't have any authentication for now. Everyone who knows the service address+port and the number is able to get your messages and send messages. So only use it a trusted environment and block external access.

Interactive Documentation

After installing signal-cli-rest-api start it and open the following page http://localhost:8000/docs

Issues
  • Cannot install through pip method

    Cannot install through pip method

    I say: pip install signal-cli-rest-api, and got an error:

    Collecting signal-cli-rest-api
      Could not find a version that satisfies the requirement signal-cli-rest-api (from versions: )
    No matching distribution found for signal-cli-rest-api
    
    

    OS is Debian Buster, 64-bit.

    opened by MatejKovacic 7
  • link device: newline character in QR code

    link device: newline character in QR code

    A newline character causes the QR code for device linking to be faulty. I am not providing a PR as I am unsure whether this can be safely escaped in run_signal_cli_command without affecting other functions, or if it should be done in link_device.

    bug 
    opened by kahrpatrick 5
  • Captcha request on /register/{number}/

    Captcha request on /register/{number}/

    When running registration like this (with a random number)

    curl -X 'POST' \
      'http://localhost:8000/register/%2B49080500' \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
      "voice_verification": true
    }'
    

    I am getting the following error:

    {
      "detail": "Starting signal-cli process failed: Captcha required for verification, use --captcha CAPTCHA\nTo get the token, go to https://signalcaptchas.org/registration/generate.html\nCheck the developer tools (F12) console for a failed redirect to signalcaptcha://\nEverything after signalcaptcha:// is the captcha token.\n"
    }
    

    Before I start poking around, maybe I am missing an obvious step? Is the captcha functionality already built into this wrapper?

    Btw, If this is an easy one, I would be happy to add documentation.

    opened by top-on 5
  • Escape strings in shell command

    Escape strings in shell command

    This PR escapes all strings that are passed to the signal-cli shell command in order to prevent shell injections. It uses a function from the shlex libary that provides

    ... a shell-escaped version of the string s. The returned value is a string that can safely be used as one token in a shell command line, for cases where you cannot use a list. [https://docs.python.org/3/library/shlex.html#shlex.quote]

    I could not yet test all the commands for possible issues with the escaping.

    opened by kahrpatrick 2
  • 500 Internal Server Error during POST to /register

    500 Internal Server Error during POST to /register

    I'm using the workaround fix that is mentioned here

    and have updated the schema/register.py and endpoint/register.py files as per the changes a couple days ago (Fixed Captcha).

    I'm getting the following when trying to register a number: INFO: 192.168.0.117:56688 - "POST /register/xxx HTTP/1.1" 500 Internal Server Error (I replaced my phone # +1231231234 with xxx) and {"detail":"Starting signal-cli process failed: OpenJDK Server VM warning: You have loaded library /tmp/resource1973025829374288195.so which might have disabled stack guard. The VM will try to fix the stack guard now.\nIt's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.\nWARN App - WARNING: Support for new group V2 is disabled, because the required native library dependency is missing: libzkgroup\nMissing required native library dependency: libsignal-client\n"}

    signal-cli 
    opened by stygarfield 2
  • Switch to alpine base image

    Switch to alpine base image

    This PR replaces the Debian base image with Alpine. It also makes use of tagged signal-cli releases instead of the master branch.

    opened by kahrpatrick 1
  • missing groupID for group messages

    missing groupID for group messages

    The send_message method of the messages endpoint does not append the groupID for group messages, resulting in an error when an API call with group: true is made. In fact, this field is also missing in the MessageOutgoing schema.

    This is the relevant section from the signal-cli man-page:

    -g GROUP, --group GROUP

    Specify the recipient group ID in base64 encoding.

    opened by kahrpatrick 1
  • Remove

    Remove "using the installation pin is currently not supported by signal-cli"

    In your newest version it seems like the installation pin IS working (not tested because I can't send messages because of another unknown error)

    opened by Dattito 1
  • Chatbot - reply message

    Chatbot - reply message

    Would it be possible to reply to messages received as a chatbot? Could you provide an example?

    opened by jersonjunior 1
  • How do I send the attachment?

    How do I send the attachment?

    How is it possible to send an attachment? Can you give an example?

    opened by MatejKovacic 0
  • Got 500 internal error

    Got 500 internal error

    Hello, everytime I try to get /message, I have an internal 500 error:

    500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 390, in run_asgi result = await app(self.scope, self.receive, self.send) File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 45, in call return await self.app(scope, receive, send) File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 171, in call await super().call(scope, receive, send) File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 102, in call await self.middleware_stack(scope, receive, send) File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 181, in call raise exc from None File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in call await self.app(scope, receive, _send) File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in call raise exc from None File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in call await self.app(scope, receive, sender) File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 550, in call await route.handle(scope, receive, send) File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 227, in handle await self.app(scope, receive, send) File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 41, in app response = await func(request) File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 196, in app raw_response = await run_endpoint_function( File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 149, in run_endpoint_function return await run_in_threadpool(dependant.call, **values) File "/usr/local/lib/python3.8/dist-packages/starlette/concurrency.py", line 34, in run_in_threadpool return await loop.run_in_executor(None, func, *args) File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.8/dist-packages/signal_cli_rest_api/app/api/api_v1/endpoints/messages.py", line 24, in get_messages return [json.loads(m) for m in response.split("\n") if m != ""] AttributeError: 'coroutine' object has no attribute 'split' /usr/local/lib/python3.8/dist-packages/uvicorn/main.py:390: RuntimeWarning: coroutine 'run_signal_cli_command' was never awaited loop.run_until_complete(self.serve(sockets=sockets)) RuntimeWarning: Enable tracemalloc to get the object allocation traceback

    opened by PimpMySocial 2
Owner
Sebastian Noel Lübke
Sebastian Noel Lübke
Backend, modern REST API for obtaining match and odds data crawled from multiple sites. Using FastAPI, MongoDB as database, Motor as async MongoDB client, Scrapy as crawler and Docker.

Introduction Apiestas is a project composed of a backend powered by the awesome framework FastAPI and a crawler powered by Scrapy. This project has fo

Fran Lozano 45 Nov 19, 2021
REST API with FastAPI and SQLite3.

REST API with FastAPI and SQLite3

Luis Quiñones Requelme 1 Oct 29, 2021
Publish Xarray Datasets via a REST API.

Xpublish Publish Xarray Datasets via a REST API. Serverside: Publish a Xarray Dataset through a rest API ds.rest.serve(host="0.0.0.0", port=9000) Clie

xarray-contrib 71 Nov 23, 2021
All of the ad-hoc things you're doing to manage incidents today, done for you, and much more!

About What's Dispatch? Put simply, Dispatch is: All of the ad-hoc things you’re doing to manage incidents today, done for you, and a bunch of other th

Netflix, Inc. 3.1k Nov 26, 2021
ReST based network device broker

The Open API Platform for Network Devices netpalm makes it easy to push and pull state from your apps to your network by providing multiple southbound

null 324 Nov 24, 2021
[rewrite 중] 코로나바이러스감염증-19(COVID-19)의 국내/국외 발생 동향 조회 API | Coronavirus Infectious Disease-19 (COVID-19) outbreak trend inquiry API

COVID-19API 코로나 바이러스 감염증-19(COVID-19, SARS-CoV-2)의 국내/외 발생 동향 조회 API Corona Virus Infectious Disease-19 (COVID-19, SARS-CoV-2) outbreak trend inquiry

Euiseo Cha 26 Nov 17, 2021
API & Webapp to answer questions about COVID-19. Using NLP (Question Answering) and trusted data sources.

This open source project serves two purposes. Collection and evaluation of a Question Answering dataset to improve existing QA/search methods - COVID-

deepset 309 Nov 7, 2021
Deploy an inference API on AWS (EC2) using FastAPI Docker and Github Actions

Deploy an inference API on AWS (EC2) using FastAPI Docker and Github Actions To learn more about this project: medium blog post The goal of this proje

Ahmed BESBES 32 Nov 22, 2021
api versioning for fastapi web applications

fastapi-versioning api versioning for fastapi web applications Installation pip install fastapi-versioning Examples from fastapi import FastAPI from f

Dean Way 312 Nov 23, 2021
This is a FastAPI application that provides a RESTful API for the Podcasts from different podcast's RSS feeds

The Podcaster API This is a FastAPI application that provides a RESTful API for the Podcasts from different podcast's RSS feeds. The API response is i

Sagar Giri 2 Nov 7, 2021
Minimal example utilizing fastapi and celery with RabbitMQ for task queue, Redis for celery backend and flower for monitoring the celery tasks.

FastAPI with Celery Minimal example utilizing FastAPI and Celery with RabbitMQ for task queue, Redis for Celery backend and flower for monitoring the

Grega Vrbančič 255 Nov 24, 2021
Social Distancing Detector using deep learning and capable to run on edge AI devices such as NVIDIA Jetson, Google Coral, and more.

Smart Social Distancing Smart Social Distancing Introduction Getting Started Prerequisites Usage Processor Optional Parameters Configuring AWS credent

Neuralet 101 Nov 19, 2021
Example app using FastAPI and JWT

FastAPI-Auth Example app using FastAPI and JWT virtualenv -p python3 venv source venv/bin/activate pip3 install -r requirements.txt mv config.yaml.exa

Sander 19 Mar 28, 2021
Web Inventory tool, takes screenshots of webpages using Pyppeteer (headless Chrome/Chromium) and provides some extra bells & whistles to make life easier.

WitnessMe WitnessMe is primarily a Web Inventory tool inspired by Eyewitness, its also written to be extensible allowing you to create custom function

byt3bl33d3r 539 Nov 22, 2021
Backend Skeleton using FastAPI and Sqlalchemy ORM

Backend API Skeleton Based on @tiangolo's full stack postgres template, with some things added, some things removed, and some things changed. This is

David Montague 13 Nov 8, 2021
FastAPI Admin Dashboard based on FastAPI and Tortoise ORM.

FastAPI ADMIN 中文文档 Introduction FastAPI-Admin is a admin dashboard based on fastapi and tortoise-orm. FastAPI-Admin provide crud feature out-of-the-bo

long2ice 979 Nov 24, 2021
A simple docker-compose app for orchestrating a fastapi application, a celery queue with rabbitmq(broker) and redis(backend)

fastapi - celery - rabbitmq - redis -> Docker A simple docker-compose app for orchestrating a fastapi application, a celery queue with rabbitmq(broker

Kartheekasasanka Kaipa 37 Nov 26, 2021
The template for building scalable web APIs based on FastAPI, Tortoise ORM and other.

FastAPI and Tortoise ORM. Powerful but simple template for web APIs w/ FastAPI (as web framework) and Tortoise-ORM (for working via database without h

prostomarkeloff 73 Nov 18, 2021
Ready-to-use and customizable users management for FastAPI

FastAPI Users Ready-to-use and customizable users management for FastAPI Documentation: https://frankie567.github.io/fastapi-users/ Source Code: https

François Voron 1.4k Nov 24, 2021