Forest_Client/Tool/BuildTool/to_wechat_robot.sh

27 lines
663 B
Bash

#!/bin/bash
# Check if exactly one arguments are provided
if [ $# -ne 3 ]; then
echo "Usage: $0 <note url> <mentioned list> <msg text>"
exit 1
fi
# Assign the input arguments to variables
NOTE_URL="$1"
MENTIONED_LIST="$2"
MSG_TEXT="$3"
echo "to wechat param : NOTE_URL=$NOTE_URL, MENTIONED_LIST=$MENTIONED_LIST, MSG_TEXT=$MSG_TEXT"
MESSAGE="{
\"msgtype\": \"text\",
\"text\": {
\"content\": \""$MSG_TEXT"\",
\"mentioned_list\":[\"$MENTIONED_LIST\"]
}
}"
echo "$MESSAGE"
# Use curl to send a POST request with the message
#curl -X POST "$NOTE_URL" -H 'Content-Type: application/json' -d "$MESSAGE"