NLDClient-yudde/Tool/BuildTool/to_wechat_robot.sh

26 lines
657 B
Bash
Executable File

#!/bin/bash
# Check if exactly one arguments are provided
if [ $# -ne 1 ]; then
echo "Usage: $0 <message>"
exit 1
fi
# Assign the input arguments to variables
MSG_TEXT="$1"
echo "$MSG_TEXT"
# Set the URL where you want to send the message
NOTE_URL="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=3c92758c-1128-4931-ac8d-f19669d7befe"
MESSAGE="{
\"msgtype\": \"text\",
\"text\": {
\"content\": \""$MSG_TEXT"\",
\"mentioned_list\":[\"@all\"]
}
}"
echo "$MESSAGE"
# Use curl to send a POST request with the message
curl -X POST "$NOTE_URL" -H 'Content-Type: application/json' -d "$MESSAGE"