# shellcheck shell=sh

___x_cmd_feishu_bot___send_json() {
    local req_json; req_json="$(___x_cmd_cmds_cat)"
    feishu:debug "$(printf "%s" "$req_json" | x jo fmt)"

    [ -n "$webhook" ] || {
        local webhook
        ___x_cmd_feishu_cur webhook:= 2>/dev/null
        [ -n "$webhook" ] || N=feishu M="Please setting up your webhook first ==> 'x feishu --cfg webhook=<your webhook url>'" log:ret:1
    }

    feishu:debug "$webhook"
    ___x_cmd curl -s -X POST                                \
                  -H 'Content-Type: application/json'       \
                  -d "$req_json"                            \
                  "$webhook?wait=true"
}
