Ben Oliver

technology

How to use Gotify with ZNC

Get IRC notifications on your phone without third party services.
05 September 2019

Gotify1 is a great way to send notifications to your phone from loads of applications. Here is how to get ZNC to send you a ping when someone messages you on IRC.

This guide assumes:

For this to work, we will be using a ZNC module called ZNC-push4. It has built-in support for loads of services, but we will be using its custom uri function to get it sending messages to our notification server.

Create an app in Gotify

Go to your Gotify admin page and create an application for ZNC. Make sure to take note of the token it gives you.

Compile and enable ZNC-Push

This sounds scarier than it is.

You need some dependencies:

sudo aptitude install znc-dev ca-certificates libcurl4-openssl-dev

Then pull a recent copy of znc-push from github:

git clone https://github.com/jreese/znc-push.git
cd znc-push

Compile it, with CURL (does not work with gotify otherwise):

make curl=yes

Copy the module into ZNC:

make install

Then jump into ZNC via your IRC client and enable the module:

/msg *status loadmod --type=user push

I like the above, because it enables it for my user, regardless of which network you are connected to. If you want it for one network and not another, you can instead do:

/msg *status loadmod push

This enables it just for the network you are connected to. DO NOT DO BOTH!! If you wish you can also enable the module via webadmin.

Configure ZNC-Push

Still in IRC, type:

/q *push

If you enabled it for your user, it will work on any network. If you enabled it for just one network, be sure to be logged into the relevant network on IRC.

In the chat window you just opened set the type of transport:

set service url

Tell it to use POST:

set message_uri_post yes

Set the message uri to your new server.

The placeholders are listed in the znc-push docs:

set message_uri https://push.example.com/message?token=FOO&title={title} from {nick} on {network}&message={message}&priority=5

You can set stuff like when it triggers etc, but those are out of the scope of this article. Check the ZNC-push docs for that, they are good.

Done! Some errors I encountered

Test your notifications like so:

send testmessagewhatever

Make sure to keep an eye on gotify. Watching it on the command line is useful because it gives you detailed real-time output about what the server is seeing and doing, along with the status codes.

These are things that went wrong. Error messages were from the gotify server output.

TLS Handshake error no server name

This was fixed by re-compiling ZNC-push to use CURL. If you followed this guide it shouldn’t happen.

Error 400

This flagged as an authentication error but it was actually a bad request as the error implies. Check for typos.

Notifications not showing/appearing silently

Make sure you set the priority! By default it doesn’t do much.

Other gotify guides

This is the first in a small series of gotify guides I intend to write, about how to plug it into various services.

Here is a list of gotify articles on this site:

Reply by email