Hi
I have attempted to follow this guide to install a 3rd party notification system using Signal, with signal-cli-rest-api
What you need
- A free phone number
- curl
- Remote ssh access with sudo access
- Docker
Signal does not offer a bot service, so we need to have an extra number to act as the bot. There are a couple of service providers which offers free phone numbers. Should be easy to obtain an extra…
I've done all changes in the file, but don't get it to work, and I cannot find the logs to be able to debug it.
Can anyone point me out on where/how to look for logs when a Notification is triggered with the "Test" button in the WebGUI in the section " System/Nofication/Settings" ?
I have setup a working server to send Signal messages, so the curl command works fine when used from the ssh shell. I use the command below:
curl -X POST -H "Content-Type: application/json" 'http://<internal IP>:<port>/v2/send' -d '{"message": "Test via Signal API!", "number": "+12345", "recipients": [ "+12345" ]}'
However, when the sync.d command shown in the GUIDE is executed, nothing happens.
there's likely a syntax error in the command shown by the GUIDE, but I can't figure out where since I don't know how to use the command "sed".
nano /usr/share/openmediavault/notification/sink.d/10signal
#!/bin/bash
sender="+12345"
recipiant="+12345"
contenttype="Content-Type: application/json"
signal_msg_url="http://<internal IP>:<port>/v2/send"
# The message file needs to altered as the new line literals does not work directly. More, monit adds a \ to the hostname. This needs to changed, too.
sed -E -i -e ':a;N;$!ba;s/\r{0,1}\n/\\n/g' -e 's|\\'"${HOSTNAME}"'|'"${HOSTNAME}"'|g' "$OMV_NOTIFICATION_MESSAGE_FILE"
content=$(cat "$OMV_NOTIFICATION_MESSAGE_FILE")
# If you want to send the message to more than 1 person, then add the number of the repcipiants in [] separated by ","
generate_msg_data()
{
cat <<EOF
{"message": "${content}", "number": "$sender", "recipients": ["$recipiant"]}
EOF
}
curl -X POST -H "$contenttype" -d "$(generate_msg_data)" "$signal_msg_url"
Alles anzeigen
thanks.