Forward Diagnosis/Messages to Gotify

It would be very helpful to have some sort of Gotify/webhook integration to expose the Pi-Hole diagnosis messages such that I could be made aware if there was an issue without having to login to the web interface or command line.

If you are asking for a webhook to expose these messages without authentication, I don't think this will happen. Pi-hole web interface avoids exposing data, including version numbers and error messages, for security reasons.


If you need this information on the Pi-hole server, you can use the command pihole api info/messages to retrieve all messages, without the need to provide a password. (Note: this command only works if executed directly in the Pi-hole server)

If you need this information on a different machine, all the information you need is available via API and it can be accessed (using authentication) via a script, web page or app that checks the /info/messages endpoint.

Very simple example

This is a very simple example (without any kind of error checking) of a script that gets the sid and uses it to access the messages.

#!/usr/bin/env bash

serverURL="http://192.168.0.206"
PASSWORD="123456"

# Authenticate and get the session ID (sid)
SID=$(curl -s -k -X POST "${serverURL}/api/auth" --data "{\"password\":\"${PASSWORD}\"}" | jq -r .session.sid)

# Get the messages as a JSON
MESSAGES=$(curl -s -k -X GET "${serverURL}/api/info/messages?sid=${SID}" | jq .messages)

# Process the messages... here you can do what ever you want. Printing as an example.
echo "${MESSAGES}"

# Logout: delete the session after using it
curl -k -X DELETE "${serverURL}/api/auth?sid=${SID}"

You will find shell, python, javascript and C examples in the documentation.