So recently with all the noise about Whatsapp changing its privacy policy and the drive to find an alternative messenger, I began to play around more with Signal. Having already successfully set up Telegram for use with Home-Assistant and Nodered, I decided to see if I could interact with Signal as well. I only found a couple of nodes online and ended up having a go with nodered-contrib-signal-client
Initially, I was having all sorts of issues trying to get this installed under the Nodered “add-on/wrapper”. Everytime I hit the install button and viewed the log, it would fail with various errors. One by one I worked through them, and through constant communication on github, managed to finally get it installed.
I needed to run several commands within the Nodered container itself which is already sitting under the Home-Assistant supervisor.
In order to do this, I utilised the “exec” node.
I needed to run the following commands:
apk update
apk upgrade
apk add g++
apk add make
apk add gcc
apk add alpine-sdk
For those of you not familiar with the execution node this allowed me to run commands directly within the Nodered container (add-on). There’s possibly easier ways of doing it via terminal, but I wanted to be sure that I was injecting the commands in to the container directly, and not into the supervisor (home-assistant installation). Here’s an example of the payload:
After running the final commands, the node installed, and I now had 5 fresh nodes to choose from.
Next step was to register the “device” for use with the signal service. This proved equally as frustrating. Initial attempts to register the installation as a signal worthy device were met with 402 errors. Basically the signal servers were denying the attempt. After further research and communication over github, it emerged that we needed to complete a signal captcha. This in itself proved awkward initially. I think my issue was I’d been trying various methods to activate the device that my IP address had been flagged as abusive, or the server was down. I returned to it a few days later, doing the exact same thing and the operation was successful.
In order to get your captcha token from Signal, you need to navigate to https://signalcaptchas.org/registration/generate.html
You then need to oepn the developer tools window and go to the console. Complete the captcha as required. In the console you should see the following: ‘signalcaptcha://03AGdB………..FZA‘ because the scheme does not have a registered handler.
We want everything after // (and before ‘) to be able to plug into our request sms node. With the account configured as follows and the captcha input, fire the flow (I connected to a debug to get some feedback). I received the following information in debug “Signal client: registration code requested via sms.”
Within seconds I received a message on my phone with a code in the format XXX-XXX.
Next I dragged out a register node and selected the account I’d previously configured. Input the code you just received XXX-XXX and fire the flow.
I’ll point out that when I checked the signal app on my phone, my phone had been unregistered. I guess authentication had switched to nodered. I re-authenticated my phone, but then had issues sending messages out. So I repeated the captcha and registered again in nodered. The phone can wait for now.
Next it was a case of testing out some simple messages.
There are two ways of constructing a message – see the examples below.
1) use JSON to send it:
{
“receiverNumber”: “+12345678910”,
“content”: “This is a test”
}
2) simply use msg.payload.content and input the message directly (as a string).
In order to receive the message you just hook up a debug to the receive node. Obviously you could use something more elaborate to broadcast or alert, but for now this is fine.
See below for an example where you could essentially send a signal message of on or off to control a lamp (on or off strings would be the outputs of the switch node).
Having gone through the hassle of getting it installed, registered and working, I’m happy to tick this box. There are some drawbacks that I’ve found though.
- By registering my number in nodered it essentially unregistered my phone, so if you wanted to communicate with the home, you’re going to want an additional number to register.
- It was quite painful to get all of this set up. Am sure someone will refine the node further to include the dependencies to allow it to install straight away without the additional execution steps I needed to go through, it might just take some time, or someone will end up forking it. I want to point out that these steps were needed to get it under the node-red add-on in Home-Assistant and not necessary for a clean installation in docker (I tried both ways).
- Another issue I had was that I needed to make sure I only had one signal receive node on the flow. If I had more than one, it meant that I was having issues receiving anything. Again, probably an initial teething problem but something to be mindful of.
As I already have telegram set up in nodered, I think I prefer to use that, as it doesn’t appear to suffer from any of the drawbacks mentioned above. I will say this, that the documentation on using this node is excellent and can be found here. You can see some of the more advanced features that you can add to your flows including attachments and pictures etc, as well as time expiry. For my needs I didn’t want to get into that.
Gausma and Fanuch were very helpful and responsive in helping to resolve some teething problems I had getting it to work.
If your interested in sharing your own solutions, tips and tricks with like minded people perhaps you’d consider joining our facebook group. The aim of this group will hopefully be more show and tell rather than support, but that’s not to say we can’t lend a helping hand!
https://www.facebook.com/groups/386238285944105
Cheers
Great article. Will try this on my setup. However I run node-red within a docker on my HomeAssistant. So i’m not sure if I can execute the “apk …” commands. Any thoughts on this? Or experts hete who have Signal running in node-red on HomeAssistant?
Hey glad you liked it. If you have node-red through add-ons in supervised then you need to use the exec node like I laid out in the article. You literally just keep pressing the Inject nodes with the additional commands. I was surprised how easy it was to be honest. I got the commands from the support pages of GitHub. If you have docker running separate from HA you can just install as is.
Thank you for the quick reply.
I managed to install all the apk’s and the Signal palette.
Now I’m facing an issue with the ‘ request sms ‘ part.
I get this error:
Signal client error: {“name”:”HTTPError”,”code”:402,”response”:”\n\n\nError 402 Payment Required\n\nHTTP ERROR 402 Payment Required\n\nURI:/v1/accounts/sms/code/+316xxxxxxxx\nSTATUS:402\nMESSAGE:Payment Required\nSERVLET:io.dropwizard.jersey.setup.JerseyServletContainer-221961af\n\n\n\n\n”}
what am I doing wrong?
I think the token is not right, because when I open de https://signalcaptchas.org/registration/generate.html URL, the page is blank. when I refresh the page it loads the CAPTCHA and I answer it. However I cannot seem to get some kind of token code from the Developer. Tools Console.
It keeps coming back with
‘ generate.html:1 Failed to launch ‘signalcaptcha://03AGdBq24Rmcxxxxxxxxxxxxx_1JCQ’ because the scheme does not have a registered handler.
what am I doing wrong?
Just checking with you Andrew: Do you still have your Node-red Signal connection up-and-running
I am getting all kinds of depreciated component warnings if I try to install the client on Node-Red
Like to know if this is till a viable path to embark on, Kind Regards Florent
Hi. I turned it off. I’m exclusively using telegram now and it’s working like a champion. I did hear WhatsApp was available to use but I prefer telegram for the two way conversation etc.