Tiny Pushover to XMPP bridge written in Go.
Pushover to XMPP
The reason for building this was my switch over from /e/OS to GrapheneOS (read more about that here) and hence the lack of a Pushover client that would function without GSF/GCM/FCM. Unfortunately the official Pushover Android app depends on the Google Service Framework and implements no websocket-driven fallback on its own. Hence, on Graphene it refuses to start.
Since I was already using Conversations, an XMPP client that works without GSF/GCM/FCM, the easiest solution for continuing to retrieve Pushover notifications on Android was to simply forward them to my XMPP server.
This quick and (very) dirty Go service does exactly that.
go build .
The binary is named
For the sake of simplicity I added a
login.sh script, which basically does
what the Pushover API documentation tells
under User Login and Device Registration in an automated fashion. The script
jq to be available. You can run it as following:
./login.sh <pushover e-mail> <pushover password> <two factor code>
The script does not implement login without 2FA, because you should use 2FA.
The script will output a Device ID and a secret. Keep those.
If you don’t trust the script, just perform the
curl requests mentioned in the
documentation yourself. You don’t have to do this before every start, it’s only
required once or in case you delete the device or the secret is invalidated.
The bridge requires a dedicated XMPP account, either on your own server or a
different one that is permitted to S2S with yours. You also have to make sure
upfront that the account is able to communicate with the target account.
pushover-to-xmpp won’t send or accept presence requests on its own, so make
sure to pre-configure the account the way you’d need it.
You can run the bridge by exporting its required ENV variables and running the
export PTX_DEVICE_ID='<pushover device id>' \ PTX_SECRET='<pushover secret>' \ PTX_XMPP_SERVER='your-xmpp.org:5222' \ PTX_XMPP_USERfirstname.lastname@example.org' \ PTX_XMPP_PASSWORD='password' \ PTX_XMPP_TLS=true \ PTX_XMPP_TARGETemail@example.com'
PTX_XMPP_TARGET is the target user that the bridge should forward Pushover
It’s best to run the bridge via e.g.
supervisord, in order to make
sure it keeps running and, in case it won’t, you’re being notified about that.
For that purpose create a dedicated user (e.g.
ptx), download and unpack one
of the binary releases
and add something along these lines to your
[program:pushover-to-xmpp] command=/home/ptx/pushover-to-xmpp numprocs=1 autostart=true startsecs=5 startretries=3 autorestart=true user=ptx directory=/home/ptx environment=PTX_DEVICE_ID="...",PTX_SECRET="...",PTX_XMPP_SERVER="...",...
environment should contain the same ENVs as listed above, separated by comma,
with each key’s value in quotes)
Whenever the bridge starts, the target user will receive a “Hello World” message to know that the bridge was just (re-?)started.
published [ ] · updated [ ]