From 18255ebd4c0ac50599284edf5f65cdf0acd4182e Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Wed, 30 Jul 2025 12:07:26 -0400 Subject: [PATCH] Improved Google Chat thread handling (#1376) --- apprise/plugins/google_chat.py | 10 +++++++++- tests/test_plugin_google_chat.py | 10 +++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/apprise/plugins/google_chat.py b/apprise/plugins/google_chat.py index 326fdb65..e7d99c33 100644 --- a/apprise/plugins/google_chat.py +++ b/apprise/plugins/google_chat.py @@ -223,7 +223,15 @@ class NotifyGoogleChat(NotifyBase): } if self.thread_key: - params["threadKey"] = self.thread_key + params.update({ + "messageReplyOption": "REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD", + }) + + payload.update({ + "thread": { + "thread_key": self.thread_key, + } + }) self.logger.debug( "Google Chat POST URL:" diff --git a/tests/test_plugin_google_chat.py b/tests/test_plugin_google_chat.py index 1d395846..a7d2d9aa 100644 --- a/tests/test_plugin_google_chat.py +++ b/tests/test_plugin_google_chat.py @@ -191,13 +191,14 @@ def test_plugin_google_chat_general(mock_post): params = mock_post.call_args_list[0][1]["params"] assert params.get("token") == token assert params.get("key") == key - assert "threadKey" not in params + assert "messageReplyOption" not in params payload = loads(mock_post.call_args_list[0][1]["data"]) + assert "thread" not in payload assert payload["text"] == "title\r\ntest body" mock_post.reset_mock() - # Test our messaging with the threadKey + # Test our messaging with the thread_key obj = Apprise.instantiate(f"gchat://{workspace}/{key}/{token}/{threadkey}") assert isinstance(obj, NotifyGoogleChat) assert ( @@ -216,9 +217,12 @@ def test_plugin_google_chat_general(mock_post): params = mock_post.call_args_list[0][1]["params"] assert params.get("token") == token assert params.get("key") == key - assert params.get("threadKey") == threadkey + assert params.get("messageReplyOption") == \ + "REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD" payload = loads(mock_post.call_args_list[0][1]["data"]) + assert "thread" in payload assert payload["text"] == "title\r\ntest body" + assert payload["thread"].get("thread_key") == threadkey def test_plugin_google_chat_edge_case():