Signal-Cli: User is not registered.

Today I installed signal-cli to send messages from an Ubuntu server to the signal messenger on my cellphone. Everything worked fine, installation, user registration and verification. I did all this with my own (low privilege) user account.

As the next step I wanted to send messages with PHP by calling the signal-cli binary with system(). Therefore the Apache-user www-data needs to have the information about the registered signal account. It is stored in my own user’s home directory in ~/.local/share/signal-cli. There is a sub-directory called data, it contains one file for each registered phone number (the filename is the phone number). I copied the directory „data“ to a place where apache can find it (let’s say /opt/signal-cli/data). Then I tried to send messages with a command like this:

/usr/local/bin/signal-cli --config /opt/signal-cli/data -u +49123456789 send -m 'Hello World' +49987654321

That does not work, the error message will be „User is not registered.“

It took a while until I noticed my mistake: The config parameter should only be the basic directory for the signal configuration. There signal-cli expects a subdirectory „data“. So the right way to call signal-cli is this:

/usr/local/bin/signal-cli --config /opt/signal-cli -u +49123456789 send -m 'Hello World' +49987654321