Improved Google Chat thread handling

pull/1376/head
Chris Caron 2025-07-29 14:08:18 -04:00
parent 8e1dad9f79
commit d3c2111c5d
2 changed files with 10 additions and 4 deletions

View File

@ -220,10 +220,15 @@ class NotifyGoogleChat(NotifyBase):
# Prepare our URL Parameters
"token": self.webhook_token,
"key": self.webhook_key,
"messageReplyOption" : "REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD",
}
if self.thread_key:
params["threadKey"] = self.thread_key
payload.update({
"thread": {
"thread_key": self.thread_key,
}
})
self.logger.debug(
"Google Chat POST URL:"

View File

@ -191,13 +191,13 @@ 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
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 +216,10 @@ 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
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():