[TUTORIAL] API examples of webhook for different services

Jul 10, 2021
93
17
13
45
www.saudiqbal.com
I used to use custom gotify php file to catch Proxmox notification into my central log and notification system but now webhook is available I got it to work directly with my own notification log system. If you have examples of webhook API working for different services post them here.

Mine is: GET: example.com/notification.php?password=password&title={{ url-encode title }}&message={{ url-encode message }}&priority={{ url-encode severity }}
 
Pushover
Have webhooks working on pushover.

Method: POST
URL: https://api.pushover.net/1/messages.json
Headers:
Key: Content-Type Value: application/json
Body:
JSON:
{
  "token": "{{ secrets.apikey }}",
  "user": "{{ secrets.userkey }}",
  "title": "{{ title }}",
  "message": "{{ escape message }}",
  "priority": "0",
  "timestamp": "{{ timestamp }}"
}
Secrets:
Key: userkey Value: <your pushover user key>
Key: apikey Value: <your pushover application key>

1732925745557.png

Some options:

Priority
For normal priority messages use "priority": "0",
For high priority messages use "priority": "1",
Emergency Messages
Use "priority": "2", and add the following (refer to Pushover documentation for what these settings do):​
JSON:
"retry": "30",
"expire": "300",
"tags": "service=pve-emergency",
I haven't quite got emergency to work. The first message is sent out, but then subsequent emergency messages are not received. I suspect the Pushover API requires the emergency to be cancelled first before subsequent emergency notifications are received by Pushover from the same host. I don't think Proxmox can be configured to send a subsequent cancel by tag notification once the status changes to resolved (I added the "tags": "service=pve-emergency", to set a tag so that a manual cancel by tag is possible and it therefore isn't strictly necessary for emergency messages).​
Others
You can use other optional Pushover API parametes such as device, sound, url, url_title and html by specifying them in the JSON format within the body.​
 
Last edited:
Pushover
Have webhooks working on pushover.

Method: POST
URL: https://api.pushover.net/1/messages.json
Headers:
Key: Content-Type Value: application/json
Body:
JSON:
{
  "token": "{{ secrets.apikey }}",
  "user": "{{ secrets.userkey }}",
  "title": "{{ title }}",
  "message": "{{ escape message }}",
  "priority": "0",
  "timestamp": "{{ timestamp }}"
}
Secrets:
Key: userkey Value: <your pushover user key>
Key: apikey Value: <your pushover application key>

View attachment 78470

Some options:

Priority
For normal priority messages use "priority": "0",
For high priority messages use "priority": "1",
Emergency Messages
Use "priority": "2", and add the following (refer to Pushover documentation for what these settings do):​
JSON:
"retry": "30",
"expire": "300",
"tags": "service=pve-emergency",
I haven't quite got emergency to work. The first message is sent out, but then subsequent emergency messages are not received. I suspect the Pushover API requires the emergency to be cancelled first before subsequent emergency notifications are received by Pushover from the same host. I don't think Proxmox can be configured to send a subsequent cancel by tag notification once the status changes to resolved (I added the "tags": "service=pve-emergency", to set a tag so that a manual cancel by tag is possible and it therefore isn't strictly necessary for emergency messages).​
Others
You can use other optional Pushover API parametes such as device, sound, url, url_title and html by specifying them in the JSON format within the body.​
I tried this and I am getting error message "Could not test target: https://api.pushover.net/1/messages.json: status code 400 (500)" when I tried testing. I tried it several times.
 
I tried this and I am getting error message "Could not test target: https://api.pushover.net/1/messages.json: status code 400 (500)" when I tried testing. I tried it several times.

I've just tried sending a test with my configuration and it works. There's likely a misconfiguration somewhere at your end.

Can you post a screenshot of your configuration screen for the webhook like the one below to confirm your settings:
1732925745557-png.78470


Have you got your userkey and apikey the correct and not mixed up?
The userkey is the one listed in your Pushover dashboard.
1736144260995.png

The apikey is the one listed for the specific application
1736144388080.png
 
  • Like
Reactions: xantonin
I've just tried sending a test with my configuration and it works. There's likely a misconfiguration somewhere at your end.

Can you post a screenshot of your configuration screen for the webhook like the one below to confirm your settings:
1732925745557-png.78470


Have you got your userkey and apikey the correct and not mixed up?
The userkey is the one listed in your Pushover dashboard.
View attachment 80250

The apikey is the one listed for the specific application
View attachment 80251
Here's my config. I just copied yours. I also checked my userkey and apikey and ensured it was in plain text and no spaces at the end/beginning (just in case ) when I copied. I don't get why it's failing. I use the same userkey but a different apikey for my Synology NAS and webhook works with no issues.
 

Attachments

  • Screenshot from 2025-01-06 09-13-05.png
    Screenshot from 2025-01-06 09-13-05.png
    122.7 KB · Views: 72
Last edited:
I've just tried sending a test with my configuration and it works. There's likely a misconfiguration somewhere at your end.

Can you post a screenshot of your configuration screen for the webhook like the one below to confirm your settings:
1732925745557-png.78470


Have you got your userkey and apikey the correct and not mixed up?
The userkey is the one listed in your Pushover dashboard.
View attachment 80250

The apikey is the one listed for the specific application
View attachment 80251
It is working now. There's a "," at the end of
Code:
"timestamp": "{{ timestamp }}",

Thank you for your help. It was driving me crazy. :)
 
  • Like
Reactions: kesawi
Hey, has anyone been able to get NTFY with authentication work?
I tried this, but I get a 403.
Code:
webhook: NTFY
        body YGBgCnt7IG1lc3NhZ2UgfX0KYGBg
        header name=Markdown,value=eWVz
        header name=username,value=<redacted>
        header name=password,value=<redacted>
        method post
        url https://ntfy.myself.it/{{ secrets.channel }}

On a side note, I know that https://{{ secrets.username }}:{{ secrets.password }}@ntfy.myself.it/ works with Curl but it's not a valid url according to Proxmox...
 
ntfy with authententication token: have a look at the attached screenshots; you have to add a header:
Key: Authorization
Value: Bearer {{ secrets.token }}

and add "token" with the actual token under secrets.

There's still some parts missing, though.
 

Attachments

  • Screenshot 2025-04-25 at 07.26.12.png
    Screenshot 2025-04-25 at 07.26.12.png
    46.8 KB · Views: 7
  • Screenshot 2025-04-25 at 07.27.24.png
    Screenshot 2025-04-25 at 07.27.24.png
    37.9 KB · Views: 6