ncarlier / webhookd

A very simple webhook server launching shell scripts.
MIT License
894 stars 80 forks source link

Sending alert from uptime kuma #100

Closed iptvcld closed 1 month ago

iptvcld commented 1 month ago

Hello; i am trying to send an alert from Kuma webhook using preset- multipart/form-data and i cannot just see the saw data coming into the webhook.

Is there a method or script i should be using to see the raw data coming in from Kuma?

ncarlier commented 1 month ago

Hello, thanks for reporting the problem. Indeed, multipart/form-data is not that well supported. I will fix this asap. However you can use Kuma's webhook using application/json preset. The JSON payload will be stored into the $1 variable.

iptvcld commented 1 month ago

Hello, thanks for reporting the problem. Indeed, multipart/form-data is not that well supported. I will fix this asap. However you can use Kuma's webhook using application/json preset. The JSON payload will be stored into the $1 variable.

Thanks I will try that. Is there a way to see the data come live on the screen?

iptvcld commented 1 month ago

Hello, thanks for reporting the problem. Indeed, multipart/form-data is not that well supported. I will fix this asap. However you can use Kuma's webhook using application/json preset. The JSON payload will be stored into the $1 variable.

I have to make a bash script to store $1 into a log file and then run the hook to view the file. Is there something built in that i can use that shows the incoming data thats in $1?

#!/bin/bash

# The first argument passed to the script ($1) is expected to be the JSON data
json_data=$1

# Define the log file path
log_file="/home/webhookd/scripts/logfile.log"

# Append the JSON data to the log file with a timestamp
echo "$(date +'%Y-%m-%d %H:%M:%S') - $json_data" >> "$log_file"

is there a way to see $1 without a script?

ncarlier commented 1 month ago

You can echo the variable inside your script. Then retrieve hook logs or enable hook log module: WHD_LOG_MODULES=hook.

Le sam. 10 août 2024, 19:27, iptvcld @.***> a écrit :

Hello, thanks for reporting the problem. Indeed, multipart/form-data is not that well supported.. I will fix this asap. However you can use Kuma's webhook using application/json preset. The JSON payload will be stored into the $1 variable.

I have to make a bash script to store $1 into a log file and then run the hook to view the file. Is there something built in that i can use that shows the incoming data thats in $1?

— Reply to this email directly, view it on GitHub https://github.com/ncarlier/webhookd/issues/100#issuecomment-2282218609, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGCKWYYZQYM77RR75UBRF3ZQZEQNAVCNFSM6AAAAABMI5VM5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBSGIYTQNRQHE . You are receiving this because you modified the open/close state.Message ID: @.***>