Stay organized with collections Save and categorize content based on your preferences.
Note: This guide explains how to build an interactive Chat app using Chat API interaction events. You can also build your Chat app as a Google Workspace add-on. To learn about which framework to use, see Build an interactive Google Chat app.
Create a Google Chat app that you can directly message and that responds by echoing your messages.
The following diagram shows the architecture and messaging pattern:
In the preceding diagram, a user interacting with an Apps Script Chat app has the following flow of information:
If it's not open already, open the Cloud project that you intend to use for this sample:
Before using Google APIs, you need to turn them on in a Google Cloud project. You can turn on one or more APIs in a single Google Cloud project.
In the Google Cloud console, enable the Google Chat API.
All apps using OAuth 2.0 require a consent screen configuration. Configuring your app's OAuth consent screen defines what is displayed to users and app reviewers, and registers your app so you can publish it later.
To set up the script, you use a template and then set your Cloud project in Apps Script.
Create the script from the templateQuickstart app
, and click Rename.You now have working app code that you can try out (as described in the following steps) and then customize to meet your requirements.
Make sure that you're signed in to the correct Google Account when you open the Apps Script template. The current account can sometimes switch to your default account without you noticing.
Create a test deploymentYou need a deployment ID for this Apps Script project, so that you can use it in the next step.
To get the head deployment ID, do the following:
Publish the Chat app from the console.
Google Chat API
, and click Google Chat API.Click Configuration and set up the Chat app:
Quickstart app
.https://developers.google.com/chat/images/quickstart-app-avatar.png
.Quickstart app
.Click Save.
The Chat app is ready to respond to messages.
Test the Chat appTo test your Chat app, open a direct message space with the Chat app and send a message:
Open Google Chat using the Google Workspace account that you provided when you added yourself as a trusted tester.
Select your Chat app from the results. A direct message opens.
Note: If you don't see your Chat app in the list of results, ensure that you've included your Google Workspace account in the Visibility settings of the Chat API Configuration page in the Google Cloud console.In the new direct message with the app, type Hello
and press enter
.
The Chat app thanks you for adding it and echoes your message.
To add trusted testers and learn more about testing interactive features, see Test interactive features for Google Chat apps.
TroubleshootWhen a Google Chat app or card returns an error, the Chat interface surfaces a message saying "Something went wrong." or "Unable to process your request." Sometimes the Chat UI doesn't display any error message, but the Chat app or card produces an unexpected result; for example, a card message might not appear.
Although an error message might not display in the Chat UI, descriptive error messages and log data are available to help you fix errors when error logging for Chat apps is turned on. For help viewing, debugging, and fixing errors, see Troubleshoot and fix Google Chat errors.
Clean upTo avoid incurring charges to your Google Cloud account for the resources used in this tutorial, we recommend that you delete the Cloud project.
Caution: Deleting a project has the following effects:
If you plan to explore multiple tutorials and quickstarts, reusing projects can help you avoid exceeding project quota limits.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Create a Google Chat app that echoes user messages using Apps Script and Google Cloud."],["This involves setting up your environment, configuring the script, publishing the app, and testing its functionality."],["Prerequisites include a Google Workspace account and a Google Cloud project."],["The app is designed to receive direct messages and participate in spaces, integrating with various Google services as needed."],["You can find troubleshooting information and cleanup instructions in the provided documentation."]]],["This guide details how to create a Google Chat app that echoes messages. Key actions include: setting up a Google Cloud environment and enabling the Chat API; configuring the OAuth consent screen; creating an Apps Script project from a template and linking it to the Cloud project; publishing the app with a deployment ID; and testing the app by sending a direct message. It also covers troubleshooting, cleanup, and suggests next steps for developing more advanced features.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4