From d53ed1cb6155164ef20af858106a1aed45f4b267 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 19 Jul 2026 15:18:55 +0100 Subject: [PATCH] fix(alerts): use PUT instead of POST for Matrix send-event endpoint The Matrix Client-Server API requires PUT for /_matrix/client/v3/rooms/{roomId}/send/{eventType}/{txnId}; sending POST would be rejected by any spec-compliant homeserver (405), so alerts would never actually send. Also documents that matrixroom must be the internal room ID, not the human-readable room alias. --- lgsm/modules/alert_matrix.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100755 => 100644 lgsm/modules/alert_matrix.sh diff --git a/lgsm/modules/alert_matrix.sh b/lgsm/modules/alert_matrix.sh old mode 100755 new mode 100644 index 417752f79..dff3e0f5d --- a/lgsm/modules/alert_matrix.sh +++ b/lgsm/modules/alert_matrix.sh @@ -13,6 +13,7 @@ if [[ "${matrixbase}" != http://* ]] && [[ "${matrixbase}" != https://* ]]; then fi matrixbase="${matrixbase%/}" +# matrixroom must be the internal room ID (e.g. !abc123:matrix.org), not the room alias (#room:matrix.org). matrixroomencoded="$(jq -rn --arg room "${matrixroom}" '$room|@uri')" matrixtxnid="$(date +%s%N)" matrixurl="${matrixbase}/_matrix/client/v3/rooms/${matrixroomencoded}/send/m.room.message/${matrixtxnid}" @@ -52,7 +53,7 @@ json="$(jq -cn --arg body "${message}" '{msgtype: "m.notice", body: $body}')" fn_print_dots "Sending Matrix alert" -matrixsend=$(curl --connect-timeout 10 -sS -X POST \ +matrixsend=$(curl --connect-timeout 10 -sS -X PUT \ -H "Authorization: Bearer ${matrixtoken}" \ -H "Content-Type: application/json" \ -d "${json}" \