From 9ea0ddbf91cce82c52c9f7d91b27bf8b4db29352 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 13 Mar 2026 23:26:10 +0200 Subject: [PATCH 1/3] Update Matrix message send endpoint Switched: * Deprecated `access_token` query param -> `Authorization` header * Undocumented/non-standard POST endpoint -> standard PUT with a transaction ID * Old /r0 -> new /v3 References: * https://github.com/matrix-org/matrix-spec-proposals/pull/4127 * https://spec.matrix.org/v1.17/client-server-api/#put_matrixclientv3roomsroomidsendeventtypetxnid --- lib/plugins/matrix/send.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/plugins/matrix/send.js b/lib/plugins/matrix/send.js index ac2df5ebd6..abe325c97d 100644 --- a/lib/plugins/matrix/send.js +++ b/lib/plugins/matrix/send.js @@ -9,20 +9,25 @@ function send( room, accessToken, retries = 3, - backoff = 5000 + backoff = 5000, + transactionId = null ) { + if (transactionId === null) { + transactionId = `ssio-${Date.now()}` + } const retryCodes = new Set([408, 429, 500, 503]); return new Promise((resolve, reject) => { const request = _request( { host, port: 443, - path: `/_matrix/client/r0/rooms/${room}/send/m.room.message?access_token=${accessToken}`, + path: `/_matrix/client/v3/rooms/${room}/send/m.room.message/${transactionId}`, headers: { + 'Authorization': `Bearer ${accessToken}`, 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(JSON.stringify(data), 'utf8') }, - method: 'POST' + method: 'PUT' }, res => { const { statusCode, statusMessage } = res; @@ -36,7 +41,8 @@ function send( room, accessToken, retries - 1, - backoff * 2 + backoff * 2, + transactionId ); }, backoff); } else { From 15f66a0712d22f1b6217d9ba184b62819d2b2126 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 13 Mar 2026 23:30:34 +0200 Subject: [PATCH 2/3] Apply suggestions from GitHub actions --- lib/plugins/matrix/send.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/plugins/matrix/send.js b/lib/plugins/matrix/send.js index abe325c97d..10fb76d5ab 100644 --- a/lib/plugins/matrix/send.js +++ b/lib/plugins/matrix/send.js @@ -10,10 +10,10 @@ function send( accessToken, retries = 3, backoff = 5000, - transactionId = null + transactionId = undefined ) { - if (transactionId === null) { - transactionId = `ssio-${Date.now()}` + if (!transactionId) { + transactionId = `ssio-${Date.now()}`; } const retryCodes = new Set([408, 429, 500, 503]); return new Promise((resolve, reject) => { @@ -23,7 +23,7 @@ function send( port: 443, path: `/_matrix/client/v3/rooms/${room}/send/m.room.message/${transactionId}`, headers: { - 'Authorization': `Bearer ${accessToken}`, + Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(JSON.stringify(data), 'utf8') }, From 0ad27113e90af7e4fbafa760b21bab0f9cadf57d Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 13 Mar 2026 23:34:43 +0200 Subject: [PATCH 3/3] Update lib/plugins/matrix/send.js --- lib/plugins/matrix/send.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/matrix/send.js b/lib/plugins/matrix/send.js index 10fb76d5ab..49e24e1bce 100644 --- a/lib/plugins/matrix/send.js +++ b/lib/plugins/matrix/send.js @@ -10,7 +10,7 @@ function send( accessToken, retries = 3, backoff = 5000, - transactionId = undefined + transactionId ) { if (!transactionId) { transactionId = `ssio-${Date.now()}`;