Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signal-cli-rest-api example works but cannot register signalbot device #51

Open
jaanli opened this issue Apr 21, 2024 · 4 comments
Open

Comments

@jaanli
Copy link
Contributor

jaanli commented Apr 21, 2024

I was able to run these steps on a Lightsail Ubuntu AWS machine: https://github.com/bbernhard/signal-cli-rest-api?tab=readme-ov-file#getting-started

To test, I sent a few test messages using the example:

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

However, when I continue along this repo's readme, and run step 1:

docker run -p 8080:8080 \
    -v $(PWD)/signal-cli-config:/home/.local/share/signal-cli \
    -e 'MODE=normal' bbernhard/signal-cli-rest-api:0.57

This succeeds.

But when I proceed to step 2, I get this error:

{"error":"Couldn't create QR code: no data to encode"}

Screenshot:

image

The full log:

$ sudo docker run -p 8080:8080 \
    -v $(pwd)/signal-cli-config:/home/.local/share/signal-cli \
    -e 'MODE=normal' bbernhard/signal-cli-rest-api:0.57
+ set -e
+ [ -z /home/.local/share/signal-cli ]
+ usermod -u 1000 signal-api
usermod: no changes
+ groupmod -g 1000 signal-api
+ chown 1000:1000 -R /home/.local/share/signal-cli
+ cat
+ cap_prefix=-cap_
+ cat /proc/sys/kernel/cap_last_cap
+ seq -s ,-cap_ 0 40
+ caps=-cap_0,-cap_1,-cap_2,-cap_3,-cap_4,-cap_5,-cap_6,-cap_7,-cap_8,-cap_9,-cap_10,-cap_11,-cap_12,-cap_13,-cap_14,-cap_15,-cap_16,-cap_17,-cap_18,-cap_19,-cap_20,-cap_21,-cap_22,-cap_23,-cap_24,-cap_25,-cap_26,-cap_27,-cap_28,-cap_29,-cap_30,-cap_31,-cap_32,-cap_33,-cap_34,-cap_35,-cap_36,-cap_37,-cap_38,-cap_39,-cap_40
+ [ normal = json-rpc ]
+ hostname -i
+ export HOST_IP=xxx
+ exec setpriv --reuid=1000 --regid=1000 --init-groups --inh-caps=-cap_0,-cap_1,-cap_2,-cap_3,-cap_4,-cap_5,-cap_6,-cap_7,-cap_8,-cap_9,-cap_10,-cap_11,-cap_12,-cap_13,-cap_14,-cap_15,-cap_16,-cap_17,-cap_18,-cap_19,-cap_20,-cap_21,-cap_22,-cap_23,-cap_24,-cap_25,-cap_26,-cap_27,-cap_28,-cap_29,-cap_30,-cap_31,-cap_32,-cap_33,-cap_34,-cap_35,-cap_36,-cap_37,-cap_38,-cap_39,-cap_40 signal-cli-rest-api -signal-cli-config=/home/.local/share/signal-cli
time="2024-04-21T15:19:39Z" level=info msg="Started Signal Messenger REST API"
[GIN] 2024/04/21 - 15:19:57 | 400 |  2.608821556s |      172.17.0.1 | GET      "/v1/qrcodelink?device_name=local"

Has anyone else run into this? Any ideas on how to debug?

The goal is to integrate with the Claude API (https://docs.anthropic.com/claude/reference/getting-started-with-the-api) and my Open Interpreter (https://github.com/OpenInterpreter/open-interpreter).

Really excited to test this out!!

@jaanli
Copy link
Contributor Author

jaanli commented Apr 21, 2024

Maybe I need to have this service running in the background? https://github.com/bbernhard/signal-cli-rest-api - and I see in the readme it says "To run the the bot you need to start the signal-cli-rest-api service and link your device with it.". I linked my device, and then I stopped the service.

@filipre
Copy link
Owner

filipre commented Apr 25, 2024

Maybe I need to have this service running in the background?

Yes, the python package acts as a handy wrapper around the signal-cli-rest-api service which is responsible for interacting with the signal servers

@filipre
Copy link
Owner

filipre commented Apr 25, 2024

{"error":"Couldn't create QR code: no data to encode"}

I'm not sure what the issue is but you could head to signal-cli-rest-api since its coming from that project

@jaanli
Copy link
Contributor Author

jaanli commented May 12, 2024

Thanks @filipre ! I confirmed that the issue does not happen with https://github.com/bbernhard/signal-cli-rest-api.

Specifically, this command in the readme does not work:

docker run -p 8080:8080 \
    -v $(PWD)/signal-cli-config:/home/.local/share/signal-cli \
    -e 'MODE=normal' bbernhard/signal-cli-rest-api:0.57

It first yields an error about the $(PWD) being incorrect (on Ubuntu 22.04.1 LTS on AWS Lightsail).

Next, the QR code does not work or generate (says error, cannot generate).

This command fixes it:

docker run -p 8080:8080 \
    -v $HOME/signal-cli-config:/home/.local/share/signal-cli \
    -e 'MODE=normal' bbernhard/signal-cli-rest-api

Then I'm able to complete step 1 of the README.

Is this helpful? Do you need any further details on these errors to reproduce? Thanks so much!!

This might be related to the following issues when I try to complete the README:

Running this command:

docker run -p 8080:8080 \ \
    -v $HOME/signal-cli-config:/home/.local/share/signal-cli \
    -e 'MODE=json-rpc' bbernhard/signal-cli-rest-api:0.57

Results in this error:

+ [ json-rpc = json-rpc ]
+ /usr/bin/jsonrpc2-helper
time="2024-05-12T18:57:43Z" level=info msg="Found number  and added it to jsonrpc2.yml"
+ service supervisor start
Starting supervisor: supervisord.
+ supervisorctl start all
+ hostname -i
+ export HOST_IP=172.17.0.2
+ exec setpriv --reuid=1000 --regid=1000 --init-groups --inh-caps=-cap_0,-cap_1,-cap_2,-cap_3,-cap_4,-cap_5,-cap_6,-cap_7,-cap_8,-cap_9,-cap_10,-cap_11,-cap_12,-cap_13,-cap_14,-cap_15,-cap_16,-cap_17,-cap_18,-cap_19,-cap_20,-cap_21,-cap_22,-cap_23,-cap_24,-cap_25,-cap_26,-cap_27,-cap_28,-cap_29,-cap_30,-cap_31,-cap_32,-cap_33,-cap_34,-cap_35,-cap_36,-cap_37,-cap_38,-cap_39,-cap_40 signal-cli-rest-api -signal-cli-config=/home/.local/share/signal-cli
time="2024-05-12T18:57:44Z" level=info msg="Started Signal Messenger REST API"
time="2024-05-12T18:57:45Z" level=error msg="Couldn't read data for number : EOF. Is the number properly registered?"

I already confirmed that I'm able to run the example here: https://github.com/bbernhard/signal-cli-rest-api?tab=readme-ov-file#dockerized-signal-messenger-rest-api and successfully sent a test message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants