Open conorsch opened 7 years ago
I'd definitely be happy to have a signal backend! I didn't realize it was possible. Would this be Linux only? I see stuff about DBus in the docs of signal-cli.
I'd definitely be happy to have a signal backend!
:tada:
Would this be Linux only?
A fine question, and one I can't answer. Planning to submit a docs PR to signal-cli to make it a little clearer for first-time users. Will poke some Mac folks and see if I can't get them to try it out.
I see stuff about DBus in the docs of signal-cli.
Looks like that's also necessary for daemon mode, which is optional and not relevant for ntfy.
According to the docs:
You can build signal-cli yourself, or use the provided binary files, which should work on Linux, macOS and Windows.
So if you install the binary and you call it using subprocess it should work on all OSes.
Implementing this is rather easy after-all. After installing signal-cli and registering a number or linking to an existing number, all you need this:
import shlex
import subprocess
# signal-cli -u '+XXXXXXXXXXXX' send -m 'hello from cli' '+YYYYYYYYYYYY'
def notify(title, message, account, recipient, **kwargs):
cmd = "signal-cli -u '{account}' send -m '{message}' '{recipient}'"
cmd = cmd.format(**locals())
subprocess.check_call(shlex.split(cmd), timeout=5)
+ this configuration:
---
backends:
- signal
signal:
account: "+XXXXXXXXXXXX"
recipient: "+YYYYYYYYYYYY"
Nevertheless, because of https://github.com/signalapp/Signal-Android/issues/8708, in order to get server notifications you need to have two different phone numbers
The Signal mobile messaging client would be a great fit for ntfy. Notably most of the current notification providers do not provide end-to-end encryption. There's already a convenient CLI client for Signal, signal-cli, that is simple to bootstrap and could handle the bulk of the logic for sending messages.
Assuming @dschep has no objections to calling the
signal-cli
directly, implementing a Signal provider in ntfy should be rather simple, wrapping those calls in a clean API.Happy to work on this.