@@ -19,195 +19,3 @@ automatically create a post-mortem in Google Docs.
1919The app adds a user-provided description of the incident resolution, a transcript
2020of the Chat conversation, and a summary of the conversation (automatically
2121generated using [ Vertex AI] ( https://cloud.google.com/vertex-ai ) ) to the post-mortem.
22-
23- ## Tutorial
24-
25- For detailed implementation instructions, follow the
26- [ Incident Response Tutorial] ( https://developers.google.com/chat/tutorial-incident-response )
27- in the Google Chat developer documentation.
28-
29- ## Run the sample
30-
31- To run this sample, you need a Google Cloud
32- [ project] ( https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy#projects )
33- in a Google Workspace account with billing enabled, required APIs turned on, and
34- authentication set up. You also need an Apps Script project connected with the
35- Google Cloud project. Once published, open the app's web page to start an
36- incident response.
37-
38- To publish the Chat app:
39-
40- ### 1. Create a Google Cloud project
41-
42- 1 . In the Google Cloud console, go to ** Menu** > ** IAM & Admin** >
43- [ ** Create a Project** ] ( https://console.cloud.google.com/projectcreate ) .
44- 1 . In the ** Project Name** field, enter a descriptive name for your project.
45- Optional: To edit the ** Project ID** , click ** Edit** . The project ID can't
46- be changed after the project is created, so choose an ID that meets your
47- needs for the lifetime of the project.
48- 1 . In the ** Location** field, click ** Browse** to display potential locations
49- for your project. Then, click ** Select** .
50- 1 . Click ** Create** . The console navigates to the Dashboard page and your
51- project is created within a few minutes.
52-
53- For further information on Google Cloud projects, refer to [ Creating and managing
54- projects] ( https://cloud.google.com/resource-manager/docs/creating-managing-projects ) .
55-
56- ### 2. Enable billing for the Google Cloud project
57-
58- 1 . In the Google Cloud console, go to [ Billing] ( https://console.cloud.google.com/billing/projects ) .
59- Click ** Menu** > ** Billing** > ** My Projects** .
60- 1 . In ** Select an organization** , choose the organization hosting your Google
61- Cloud project.
62- 1 . In the project row, open the ** Actions** menu, click ** Change billing** ,
63- and choose the desired destination Cloud Billing account.
64- <font size =" 1 " >Note: If you are not able to select Change billing, you do
65- not have the permissions needed to make this change. See [ Permissions
66- required to enable billing] ( https://cloud.google.com/billing/docs/how-to/modify-project#required-permissions-enable )
67- for more information.</font >
68- 1 . Click ** Set account** .
69- 1 . (Optional) After you link a project to a billing account, you can [ lock
70- the link] ( https://cloud.google.com/billing/docs/how-to/secure-project-billing-account-link )
71- to prevent the project from unintentionally being moved (linked) to a different
72- billing account or the project link being deleted from the billing account.
73-
74- ### 3. Enable the APIs
75-
76- 1 . To complete this tutorial, you must
77- [ enable] ( https://console.cloud.google.com/flows/enableapi?apiid=chat.googleapis.com,%20docs.googleapis.com,%20admin.googleapis.com,%20aiplatform.googleapis.com )
78- the following APIs:
79- 1 . Google Chat API
80- 1 . Google Docs API
81- 1 . Admin SDK API
82- 1 . Vertex AI API
83- 1 . Confirm that you're enabling the APIs in the correct project, then click ** Next** .
84- 1 . Confirm that you're enabling the correct APIs, then click ** Enable** .
85- 1 . Optionally, to enable the APIs manually:
86- 1 . In the Google Cloud console, click ** Menu** > ** APIs & Services** >
87- [ ** Enabled APIs & Services** ] ( https://console.cloud.google.com/apis/dashboard ) .
88- 1 . Click ** + Enable APIs And Services** .
89- 1 . Search for each required API, click it, then click ** Enable** .
90-
91- ### 4. Set up authentication and authorization
92-
93- Authentication and authorization lets the Google Chat app access resources in
94- Google Workspace and Google Cloud necessary to process an incident response,
95- including the ability to create spaces, add people to spaces, post messages to
96- spaces, and create Google Docs documents.
97-
98- ** Tip** : If you don't know required consent screen information, you can use
99- placeholder information prior to publicly releasing your Google Chat app. In this
100- tutorial, the app is published internally. When you publish it externally,
101- replace placeholder information with real information.
102-
103- To learn more about authentication in Google Chat, see [ Authenticate and authorize
104- Chat apps and Google Chat API requests] ( https://developers.devsite.corp.google.com/chat/api/guides/auth ) .
105-
106- 1 . In the Google Cloud console, go to ** Menu** > ** APIs & Services** >
107- [ ** OAuth consent screen** ] ( https://console.cloud.google.com/apis/credentials/consent ) .
108- 1 . Under User type, select ** Internal** , then click ** Create** .
109- 1 . In ** App name** , enter ` Incident Response ` .
110- 1 . In ** User support email** , select your email address or an appropriate Google group.
111- 1 . Under Developer contact information, enter your email address.
112- 1 . Click ** Save and Continue** .
113- 1 . Click ** Add or Remove Scopes** . A panel appears with a list of scopes for each
114- API you've enabled in your Google Cloud project.
115- 1 . Select the following scopes:
116- 1 . ` https://www.googleapis.com/auth/chat.spaces.create `
117- 1 . ` https://www.googleapis.com/auth/chat.memberships `
118- 1 . ` https://www.googleapis.com/auth/chat.memberships.app `
119- 1 . ` https://www.googleapis.com/auth/chat.messages `
120- 1 . ` https://www.googleapis.com/auth/documents `
121- 1 . ` https://www.googleapis.com/auth/admin.directory.user.readonly `
122- 1 . ` https://www.googleapis.com/auth/script.external_request `
123- 1 . ` https://www.googleapis.com/auth/userinfo.email `
124- 1 . ` https://www.googleapis.com/auth/cloud-platform `
125- 1 . If you add these scopes manually, click ** Add to Table** .
126- 1 . Click ** Update** .
127- 1 . Click ** Save and Continue** .
128- 1 . Review the app registration summary, then click ** Back to Dashboard** .
129-
130- ### 5. Create an Apps Script project and connect it to the Google Cloud project
131-
132- Before creating the Apps Script project, copy your Google Cloud project number.
133- After creating an Apps Script project, you use your Google Cloud project number
134- to connect your Google Cloud project and Apps Script project.
135-
136- Also, enable the [ Admin SDK Directory service] ( https://developers.google.com/apps-script/advanced/admin-sdk-directory ) ,
137- which the incident response app uses to get users' display names.
138-
139- To connect the projects:
140-
141- 1 . Copy your Cloud project number:
142- 1 . Go to your Cloud project in the [ Google Cloud console] ( https://console.cloud.google.com/ ) .
143- 1 . Click ** Settings and Utilities** > ** Project settings** .
144- 1 . Copy the Project number.
145- 1 . Go to [ Apps Script] ( https://script.google.com/ ) .
146- 1 . Click ** New project** . Apps Script creates an untitled project showing a file
147- called `Code.gs`` which consists of a single function. Ignore this file for now.
148- 1 . Rename the Apps Script project:
149- 1 . Click ** Untitled project** .
150- 1 . In ** Project title** , enter ` Incident Response Chat app ` .
151- 1 . Click ** Rename** .
152- 1 . In the Chat app Apps Script project, click ** Project Settings**
153- ![ ] ( https://fonts.gstatic.com/s/i/short-term/release/googlesymbols/settings/default/24px.svg ) .
154- 1 . Select ** Show "appsscript.json" manifest file in editor** .
155- 1 . Under Google Cloud Platform (GCP) Project, click ** Change project** .
156- 1 . In ** GCP project number** , paste the Google Cloud project number.
157- 1 . Click ** Set project** . The Google Cloud project and Apps Script project are now connected.
158-
159- To enable the Admin SDK Directory service:
160-
161- 1 . At the left, click ** Editor** code.
162- 1 . At the left, next to ** Services** , click ** Add a service** .
163- 1 . Select ** Admin SDK API** .
164- 1 . In ** Identifier** , select ** AdminDirectory** .
165- 1 . Click ** Add** .
166-
167- Now that you've created and configured a Google Cloud project and Apps Script project,
168- you're ready to copy the code into your project and run the sample.
169-
170- ### 6. Copy the code and deploy the Chat app
171-
172- 1 . Rename the file ` Code.gs ` to ` ChatApp.gs ` .
173- 1 . Replace the template code in the editor with the contents of the files in this sample,
174- including the file ` appsscript.json ` . Create new files as needed.
175- 1 . In the file ` Consts.js ` , replace the value of the ` PROJECT_ID ` with the ID
176- (not the number) of your GCP Project, which you can copy from the
177- [ Google Cloud Console] ( https://console.cloud.google.com/ ) .
178- 1 . Click ** Deploy** > ** New deployment** .
179- 1 . Click the icon besides ** Select type** and select both ** Wep app** and ** Add-on** .
180- 1 . Name your deployment and click ** Deploy** .
181- 1 . Copy the ** Deployment ID** to use in your Chat app configuration.
182- Copy the ** Web app URL** to access your app later.
183-
184- The Apps Script app is now deployed.
185-
186- ### 7. Configure the Chat API
187-
188- 1 . In the [ Google Cloud Console] ( https://console.cloud.google.com/ ) , search for
189- ** Google Chat API** , and click ** Google Chat API** .
190- 1 . Click ** Manage** .
191- 1 . Click [ ** Configuration** ] ( https://console.cloud.google.com/apis/api/chat.googleapis.com/hangouts-chat )
192- and set up the Chat app:
193- 1 . In the ** App name** field, enter ` Incident Response Chat app ` .
194- 1 . In the ** Avatar URL** field, enter ` https://developers.google.com/chat/images/quickstart-app-avatar.png ` .
195- 1 . In the ** Description** field, enter ` Incident Response Chat app ` .
196- 1 . Under ** Functionality** , select ** Enable interactive features** ,
197- ** Receive 1:1 messages** and ** Join spaces and group conversations** .
198- 1 . Under ** Connection settings** , select ** Apps Script project** and paste
199- the ** Deployment ID** into the field.
200- 1 . Under ** Slash commands** , add a slash command with the name ` /closeIncident ` ,
201- the ID ` 1 ` , and give it a description.
202- 1 . Under ** Permissions** , select ** Specific people and groups in your domain** ,
203- and enter your email.
204- 1 . Click ** Save** and refresh the page.
205- 1 . On the configuration page, under ** App status** , set the status to
206- ** Live - available to users** .
207- 1 . Click ** Save** .
208-
209- The Chat app is ready to respond to messages.
210-
211- ### 8. Open the web page
212-
213- Navigate to the ** Web app URL** from the Apps Script deployment to test your app.
0 commit comments