|
@ -3,9 +3,9 @@ |
|
|
# Send message to a matrix room. API call looks like this: |
|
|
# Send message to a matrix room. API call looks like this: |
|
|
# curl -XPOST -d '{"msgtype":"m.text", "body":"hello"}' "http://matrix.org/_matrix/client/api/v1/rooms/%21CvcvRuDYDzTOzfKKgh%3Alocalhost/send/m.room.message?access_token=YOUR_ACCESS_TOKEN" |
|
|
# curl -XPOST -d '{"msgtype":"m.text", "body":"hello"}' "http://matrix.org/_matrix/client/api/v1/rooms/%21CvcvRuDYDzTOzfKKgh%3Alocalhost/send/m.room.message?access_token=YOUR_ACCESS_TOKEN" |
|
|
|
|
|
|
|
|
log () |
|
|
|
|
|
|
|
|
log_debug () |
|
|
{ |
|
|
{ |
|
|
if [[ $1 == "debug" ]]; then |
|
|
|
|
|
|
|
|
if [[ $1 == "true" ]]; then |
|
|
echo "DEBUG: $2" |
|
|
echo "DEBUG: $2" |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
@ -48,14 +48,14 @@ thismsgtype="$(jq -r '.params.msgtype // ""' < "${payload}")" |
|
|
[[ -n $thismsgtype && $thismsgtype != $msgtype ]] && msgtype="${thismsgtype}" |
|
|
[[ -n $thismsgtype && $thismsgtype != $msgtype ]] && msgtype="${thismsgtype}" |
|
|
|
|
|
|
|
|
always_notify="$(jq -r '.params.always_notify // "false"' < "${payload}")" |
|
|
always_notify="$(jq -r '.params.always_notify // "false"' < "${payload}")" |
|
|
debug="$(jq -r '.params.debug // ""' < "${payload}")" |
|
|
|
|
|
|
|
|
debug="$(jq -r '.params.debug // "false"' < "${payload}")" |
|
|
silent="$(jq -r '.params.silent // "true"' < "${payload}")" |
|
|
silent="$(jq -r '.params.silent // "true"' < "${payload}")" |
|
|
link="$(jq -r '.params.link // "false"' < "${payload}")" |
|
|
link="$(jq -r '.params.link // "false"' < "${payload}")" |
|
|
team="$(jq -r '.params.team // "main"' < "${payload}")" |
|
|
team="$(jq -r '.params.team // "main"' < "${payload}")" |
|
|
prefix="$(jq -r '.params.prefix // ""' < "${payload}")" |
|
|
prefix="$(jq -r '.params.prefix // ""' < "${payload}")" |
|
|
is_html="$(jq -r '.params.is_html // "false"' < "${payload}")" |
|
|
is_html="$(jq -r '.params.is_html // "false"' < "${payload}")" |
|
|
|
|
|
|
|
|
log("$debug", "$(jq '.' < "${payload}")") |
|
|
|
|
|
|
|
|
log_debug("$debug" "$(jq '.' < "${payload}")") |
|
|
|
|
|
|
|
|
TEXT_FILE_CONTENT="" |
|
|
TEXT_FILE_CONTENT="" |
|
|
[[ -n "${text_file}" && ! -f "${text_file}" ]] && TEXT_FILE_CONTENT="_(text_file not found)_" |
|
|
[[ -n "${text_file}" && ! -f "${text_file}" ]] && TEXT_FILE_CONTENT="_(text_file not found)_" |
|
|