Dockerized Signal Messenger REST API

Friday, December 22 2023

If you want a method of sending yourself Signal messages, this is how you can do that using https://github.com/bbernhard/signal-cli-rest-api.

First run,

mkdir $HOME/.local/share/signal-cli

Then,

sudo docker run -d --name signal-api --restart=always -p 8080:8080 -v $HOME/.local/share/signal-cli:/home/.local/share/signal-cli -e 'MODE=native' bbernhard/signal-cli-rest-api

The Docker instance will be running now, however, you'll still need to link this server to your phone. First, generate a QR Code,

curl http://localhost:8080/v1/qrcodelink?device_name=signal-api --output $HOME/signal/signal_qr_code.png

Download it to your local desktop if you're using a headless server to host the Docker image,

scp john@192.168.0.123:~/signal/signal_qr_code.png ~/Documents

Scan the QR code with your Signal app on your phone, and it should now be linked. You can test whether it's working by running,

curl -X POST -H "Content-Type: application/json" 'http://localhost:8080/v2/send' -d '{"message": "Test via Signal API!", "number": "+11234567890", "recipients": [ "+11234567890" ]}'

You should receive the message on your phone if you've entered your phone number.

 

Comment
Optional
No comments yet...