diff --git a/apps-script/webhook/thread-reply.gs b/apps-script/webhook/thread-reply.gs index bc474f75..8b40b306 100644 --- a/apps-script/webhook/thread-reply.gs +++ b/apps-script/webhook/thread-reply.gs @@ -17,13 +17,13 @@ // [START google_chat_webhook] function webhook() { - const url = "https://chat.googleapis.com/v1/spaces/{{'SPACE_ID'}}/messages?key={{'KEY'}}&token={{'TOKEN'}}&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD"; + const url = "https://chat.googleapis.com/v1/spaces/SPACE_ID/messages?key=KEY&token=TOKEN&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD" const options = { "method": "post", "headers": {"Content-Type": "application/json; charset=UTF-8"}, "payload": JSON.stringify({ "text": "Hello from Apps Script!", - "thread": {"threadKey": "{{'THREAD_KEY_VALUE'}}"} + "thread": {"threadKey": "THREAD_KEY_VALUE"} }) }; const response = UrlFetchApp.fetch(url, options); diff --git a/apps-script/webhook/webhook.gs b/apps-script/webhook/webhook.gs index 058969c7..afa1b173 100644 --- a/apps-script/webhook/webhook.gs +++ b/apps-script/webhook/webhook.gs @@ -17,7 +17,7 @@ // [START hangouts_chat_webhook] function webhook() { - const url = "https://chat.googleapis.com/v1/spaces/{{'SPACE_ID'}}/messages?key={{'KEY'}}&token={{'TOKEN'}}"; + const url = "https://chat.googleapis.com/v1/spaces/SPACE_ID/messages" const options = { "method": "post", "headers": {"Content-Type": "application/json; charset=UTF-8"}, diff --git a/node/webhook/index.js b/node/webhook/index.js index 91c8707b..f6cff94f 100644 --- a/node/webhook/index.js +++ b/node/webhook/index.js @@ -21,7 +21,7 @@ * @return {Object} response */ async function webhook() { - const url = "https://chat.googleapis.com/v1/spaces/{{'SPACE_ID'}}/messages?key={{'KEY'}}&token={{'TOKEN'}}"; + const url = "https://chat.googleapis.com/v1/spaces/SPACE_ID/messages" const res = await fetch(url, { method: "POST", headers: {"Content-Type": "application/json; charset=UTF-8"}, diff --git a/node/webhook/thread-reply.js b/node/webhook/thread-reply.js index 2aea38c9..f36cb101 100644 --- a/node/webhook/thread-reply.js +++ b/node/webhook/thread-reply.js @@ -21,13 +21,13 @@ * @return {Object} response */ async function webhook() { - const url = "https://chat.googleapis.com/v1/spaces/{{'SPACE_ID'}}/messages?key={{'KEY'}}&token={{'TOKEN'}}&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD"; + const url = "https://chat.googleapis.com/v1/spaces/SPACE_ID/messages?key=KEY&token=TOKEN&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD" const res = await fetch(url, { method: "POST", headers: {"Content-Type": "application/json; charset=UTF-8"}, body: JSON.stringify({ text: "Hello from a Node script!", - thread: {threadKey: "{{'THREAD_KEY_VALUE'}}"} + thread: {threadKey: "THREAD_KEY_VALUE"} }) }); return await res.json(); diff --git a/python/webhook/quickstart.py b/python/webhook/quickstart.py index f8f86beb..aa899969 100644 --- a/python/webhook/quickstart.py +++ b/python/webhook/quickstart.py @@ -18,12 +18,10 @@ from json import dumps from httplib2 import Http -WEBHOOK_URL = "https://chat.googleapis.com/v1/spaces/{{'SPACE_ID'}}/messages?key={{'KEY'}}&token={{'TOKEN'}}" - def main(): """Google Chat incoming webhook quickstart.""" - url = WEBHOOK_URL + url = "https://chat.googleapis.com/v1/spaces/SPACE_ID/messages" app_message = {"text": "Hello from a Python script!"} message_headers = {"Content-Type": "application/json; charset=UTF-8"} http_obj = Http() diff --git a/python/webhook/thread-reply.py b/python/webhook/thread-reply.py index 3ee46006..f1e6a7f4 100644 --- a/python/webhook/thread-reply.py +++ b/python/webhook/thread-reply.py @@ -23,17 +23,16 @@ # # Then, append messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD to the # webhook URL. -WEBHOOK_URL = "https://chat.googleapis.com/v1/spaces/{{'SPACE_ID'}}/messages?key={{'KEY'}}&token={{'TOKEN'}}&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD" def main(): """Google Chat incoming webhook that starts or replies to a message thread.""" - url = WEBHOOK_URL + url = "https://chat.googleapis.com/v1/spaces/SPACE_ID/messages?key=KEY&token=TOKEN&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD" app_message = { "text": "Hello from a Python script!", # To start a thread, set threadKey to an arbitratry string. # To reply to a thread, specify that thread's threadKey value. - "thread": {"threadKey": "{{'THREAD_KEY_VALUE'}}"}, + "thread": {"threadKey": "THREAD_KEY_VALUE"}, } message_headers = {"Content-Type": "application/json; charset=UTF-8"} http_obj = Http()