signal-cli-rest-api
signal-cli-rest-api copied to clipboard
Send Reaction Endpoint Not Working
The problem
Hi,
I have been using the API for a few months now and it seems like every endpoint works perfectly except for the SendReaction endpoint. I am sending a POST request to http://127.0.0.1:8080/v1/reactions/<my number> with the body:
{ "reaction": "👍", "recipient": "<recipient number>", "target_author": "<recipient number>", "timestamp": <timestamp of message I am reacting to> }
Am I doing something wrong here?
Are you using the latest released version?
- [x] Yes
Have you read the troubleshooting page?
- [x] Yes
What type of installation are you running?
signal-cli-rest-api Docker Container
In which mode are you using the docker container?
Native Mode
What's the architecture of your host system?
x86-64
Additional information
No response
What's the HTTP status code of the response? Do you get any error back from the API? Do you see any errors in the log?
The request returns status code 204 with no error. I just double checked the log and there are no errors there either. Even though it seems like it should work, there is no reaction attached to the message when I check Signal.
Strange...works for me.
Are you sure, that the recipient, target_author and timestamp are correctly set?
I am using it like this:
I receive a message with the following:
"envelope": { "source": <source_id>, "sourceNumber": null, "sourceUuid": <source_id>, "sourceName": "Person XYZ", "sourceDevice": 2, "timestamp": 1737656436592, "serverReceivedTimestamp": 1737656435278, "serverDeliveredTimestamp": 1737656443637, "dataMessage": { "timestamp": 1737656436592, "message": "hi", "expiresInSeconds": 0, "viewOnce": false } }
I then send a POST request to http://127.0.0.1:8080/v1/reactions/<my number> with the body:
{ "reaction": "👍", "recipient": <source_id>, "target_author": <source_id>, "timestamp": 1737656436592 }
The response code is 204, but when I check Signal there is no reaction attached to the message.
Could you please let me know if I am using it correctly?
That looks okay to me. The source_id is the recipient's number starting with +..., right?
How did you send the the request? with curl?
The source_id is the "sourceUuid" of the Signal user. Since some people hide their phone number on Signal, I use the uuid instead. The uuid works for sending messages to the recipient, so I assumed the same would work for sending a reaction.
I also just tested it out with the recipient's number and it still does not work for me.
I am using Postman to send my test requests and the Python requests library for the actual program.
The
source_idis the "sourceUuid" of the Signal user. Since some people hide their phone number on Signal, I use the uuid instead. The uuid works for sending messages to the recipient, so I assumed the same would work for sending a reaction.I also just tested it out with the recipient's number and it still does not work for me.
I am using Postman to send my test requests and the Python requests library for the actual program.
I just tested it and the underlying signal-cli (which the REST API wrapper is based on) does not do much sanity checking. So e.g if you pass something invalid (e.g some text string) to the reaction, it would still return "everything is fine", but nothing is shown in Signal.
Could it be, that Postman maybe can't handle the "👍" properly and maybe sends differently encoded characters to the REST API endpoint?
In order to test that, you could enable the debug mode (https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/DEBUG.md) and check in the logs how the actual signal-cli command looks like.
I just enabled debug mode and found the following logged in docker:
time="2025-01-23T19:12:31Z" level=debug msg="*) signal-cli --config /home/.local/share/signal-cli -a <my_number> sendReaction <source_number> -e 👍 -a <source_number> -t 1737659440753"
Does this look correct?
After some testing, I discovered that it works when I execute the following bash commands within the container:
apt-get update && apt-get install -y locales
locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Would it be possible to modify the Dockerfile in the next release to include these?
I still don't get why it doesn't work for you. What character enconding do you use? UTF8?
Yes, I'm using UTF8 encoding. I found this issue: https://github.com/AsamK/signal-cli/issues/1449 and realized that the issue might be with the Docker locales on Windows. When I generated and set the locales within the container, the issue was fixed.
Does this image work for you: bbernhard/signal-cli-rest-api:0.177-dev?
Hi, sorry I wasn't able to test this earlier and thank you for taking the time to make the change. I just tried it out and that image works perfectly.
I was also able to get it working by creating my own Dockerfile with the following:
FROM bbernhard/signal-cli-rest-api:latest
ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
RUN apt-get update && apt-get install -y locales && \
locale-gen en_US.UTF-8 && \
update-locale LANG=en_US.UTF-8 && \
apt-get clean && rm -rf /var/lib/apt/lists/*
Just out of curiosity, was this similar to the change you made in the new image?
Just out of curiosity, was this similar to the change you made in the new image?
Sorry, didn't see that message. That's the changeset: https://github.com/bbernhard/signal-cli-rest-api/commit/0eeb51da1971936c3386dc3eae023fd323551597