libs/pysignald | ||
receiver | ||
sender | ||
worker | ||
.gitignore | ||
docker-compose.yml | ||
README.md | ||
registrations.json.template |
signal-mass-dockerized
Set of docker containers for asynchronous Signal message processing (sending & receiving). It can be used as a gateway for automated notifications, bot with automatic replies or Signal equivalent of Telegram public groups where individuals can't see other users in group.
Signald
https://gitlab.com/thefinn93/signald
daemon that facilitates communication over Signal.
Using fixed pysignald https://gitlab.com/stavros/pysignald as python library. Latest version of pysignald is not compatible with changes in Signal protocol.
Create directories /signald, /signald/run, /signald/gradle
to avoid permissions issues with socket. You may still need to chown them if signald is not working
registrations.json
Simple json file that receiver and sender scripts use as source of registered Signal accounts.
At this time registrations need to be added manually to this file.
Receiver
Creates threads for each registered number (in registrations.json) and listens for new messages.
If there is new message, it writes it to RabbitMQ (queue signal-receive) for processing.
Sender
Listens for new messages in RabbitMQ (queue signal-send) and sends them to signald.
RabbitMQ
Stores received messages and messages that are supposed to be sent out.
Reason for using it is to accomodate communication between scripts and to be able to receive, send and process messages asynchronously.
Worker
Processes recieved messages in RabbitMQ and sends new messages into it.
Doesn't care about the state of sending or receiving (for now).
More workers could be added for different tasks if needed.
Right now, worker just takes received message and sends it back to the sender.
In future, there should be API for receiving messages from other apps and respond to automatic messages.
New number registrations
For adding new number and testing it out, use this. (ofc not in one run...)
from signald import Signal #or import pysignald from /libs
s = Signal("+1234567890")
# If you haven't registered/verified signald, do that first:
s.register(voice=False)
s.verify("sms code")
s.send_message("+1098765432", "Hello there!")
for message in s.receive_messages():
print(message)
Working scheme
+-------------------------+
| |
+--------------+ signald <------------------+
| | | |
| +-------------------------+ |
| |
| |
| |
| |
+------------v---------+ +---------------------+ +----------------------+
| | | | | |
| Receiver +-------> registrations.json <-------+ Sender |
| | | | | |
+----------------------+ +---------------------+ +-----------^----------+
| |
| |
| |
| |
| |
| +----------------------+ |
| | | |
+-----------------> RabbitMQ +------------------+
| |
+-----------^----------+
|
|
|
|
+-----------v----------+
| |
| Worker |
| |
+----------------------+