![]() ![]() This will enable the API for your project. Search for Hangouts Chat API and click the only result.Going back to ☰ > APIs & Services, and select Library.If lost, you will need to delete and create new credentials for this account. This will initiate a download of a credentials file which you will need to use to access the API as this service account.This will be called Click ADD KEY > Create new key Under the Service Accounts section, click you newly-created service account. After creating the Service Account, you will be redirected back to the list of Credentials you can use for the GCP Project.These will be needed for the code provided in the example from the Developing bots with Apps Script page. Your service account has now been created. Give the service account a name and a description, and press CREATE, followed by CONTINUE, and finally DONE.At the top of this page, click + CREATE CREDENTIALS > Service Account.Click the ☰ icon in the top-left, and follow the APIs & Services > Credentials menu item.Press CREATE - a new pop-up will appear in the top-right of the screen confirming that a new project is being created.You will need to provide a Project name, the other fields should be filled out for you automatically.Hit Select a project at the top of the page and click NEW PROJECT. Navigate to the Google Cloud Console and create a new GCP Project.The whole process can be quite arduous for the unintitiated, so I will provide the steps from start to finish here. ![]() This means, that you must first set up a service account in the GCP console so that the chat.bot scope can be used for these messages. This requires the use of a Cloud service account (see documentation) via the OAuth2 for Apps Script library. the only way to achieve this currently is via the external HTTP API (see documentation). More Information:Īs per the documentation you linked on Developing bots with Apps Script, for sending async messages on trigger: To set up a chat bot with the REST API, you must use a service account. I can confirm that the chat.bot scope does indeed exist. They are either unaware that their REST API does not work, or they deprecated the REST API without telling anyone. It seems that Google's documentation is outdated, and none of the examples for this API work as of August 2020. ![]() How to send messages from Google Apps Script to Google Chat using the Google Chat REST API? auth/chat), but that scope does not exist either: This StackOverflow user says they were able to use the chat scope (i.e.404 truncated server response on Apps Script Bot.Asynchronously Respond in new Hangout Chat using rest API.These StackOverflow solutions all make use of the same non-existant chat.bot scope:.The official Apps Script tutorial from Google does not work because the chat.bot scope no longer exists:. ![]() I have read through every question on StackOverflow that is related to this Chat API, plus every tutorial for the REST API. If you navigate to that URL, you will see this 404 error: Not Foundįurthermore, if you check the list of available OAuth2 scopes, you will notice that there are no scopes related to Hangouts or Chat, and there is no mention of the chat.bot the scope which was used in the example code. The problem is that in their example, the SCOPE is set to a URL that no longer exits: var SCOPE = '' Here is Google's example code for creating a message using the REST API. The Google Chat REST API has a method to create a message asynchronously, but this method ( ) does not work! There are no working examples of this method from 2020. Now I need a way to send asynchronous messages so that the bot can send messages on its own, or send multiple separate responses at a time. I have created a new chatbot using Google Apps Script, which receives messages from users in Google Chat and responds synchronously with a single message (each message can only have one response from the chatbot). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |