Notify the received HTTP request in sum
Sim4n6 opened this issue · comments
Sim4n6 commented
Hi,
Thank you for this wonderful tool.
I would like to notify the whole received request with PATH QUERY ALL_HEADERS and BODY to a discord webhook.
I've already done that for the header user_agent
but the rest is still to be figured out.
Could you please help me write the bash script? I mean ...
#!/bin/bash
echo "notify: what-in-here do you suggest please"
echo "notify: $user_agent
Nicolas Carlier commented
Hi,
query parameters and headers are converted into shell variables: https://github.com/ncarlier/webhookd#webhook-parameters
If you need to go through all the variables, you can do this below:
while IFS='=' read -r -d '' n v; do
echo "notyfy: $n=$v"
done < <(env -0)
But if you know the query header or parameter, you can refer to it directly:
# Content-Type
echo "notify: $content_type"
# User-Agent
echo "notify: $user_agent"
...
# regarding the path
echo "notify: $hook_method"
# regarding the body
echo "notify: $1"