Giter Club home page Giter Club logo

hangouts-chat-apps-script-codelab's People

Contributors

googleworkspace-bot avatar grant avatar telpirion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hangouts-chat-apps-script-codelab's Issues

Async Hangouts Apps Script - user has to auth, leave space, and then return to trigger onAddToSpace(e)

I followed the instructions here: https://developers.google.com/hangouts/chat/how-tos/bots-apps-script#async_messages

When someone else in my organization adds the bot, the bot lets them know it requires configuration and takes them to the Apps Scripts authorization screen. Afterwards though, the bot does not function as the spaceId is not captured within script properties.

Only after removing the bot from the space and then re-adding it does it successfully add the spaceId to the App Script project script properties and begin to function.

Am I doing something wrong here or is this expected behavior?

Tutorial Updates

This contains a small list of suggested updates for the Chat App that was shared on August 25, 2022 as a part of the Creating Google Workspace chat apps—what developers need to know live intro.

Link to Chat App code lab.

It seems that the tutorial was built with the old Apps Script IDE in mind that is due to be sunsetted soon (At the time of writing this).

I am grateful for the tutorial and appreciate all the work put into it.

Note: I am sure that the tutorial was written with a particular style guide in mind. I've tried to keep the language and style as close to the original, but I have no knowledge of the guide.

Original text is quoted, suggested revision is below it

3. Create the handlers for Google Chat events

Click File > Rename... and rename the new script ‘Attendance Bot'.

In the top-left of the editor, click on 'Untitled project' and rename the new script ‘Attendance Bot'.

Green note reads:

Note: You can also create a Google Chat app from a template. To do so, in the Apps Script Editor click Help > Welcome screen. In the dialog box under Create a script for, click Google Chat App.

Note: You can also create a Google Chat app from a template. To do so, navigate to the App Script homepage. Select Getting Started from the sidebar menu. Scroll down the list of templates until you find the Chat App card.

4. Publish and test the Chat app

Apps script JSON

Currently...

{
  "timeZone": "America/Los_Angeles",
  "dependencies": {
  },
  "chat": {}
}

Update to...

{
  "timeZone": "America/Los_Angeles",
  "dependencies": {
  },
  "chat": {},
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8"
}

The above includes exception login and runtime version that comes standard with the manifest file now.

Create a new Google Cloud Console project - Steps

Items 3 and 4 need updating:

  1. Click on the menu icon +icon+ in the upper left and navigate to APIs & Services > Credentials. Click on the OAuth consent screen tab (direct link).
  2. In the field Application name enter "Attendance Bot" and click the Save button at the bottom.
  1. Click on the menu icon +icon+ in the upper left and navigate to APIs & Services > OAuth consent screen tab (direct link).
  2. For this tutorial select User type as 'Internal' and select Create
  3. In the App name field enter "Attendance Bot".
  4. In the User support email field use the dropdown menu and select your email.
  5. Scroll down to the bottom of the page and in the Email addresses field under the Developer contact information header, enter your email address.
  6. Click Save and continue.
  1. Back in the App Script Editor, click Resources > Cloud Platform project.
  1. Back in the Apps Script Editor, select Project Settings +icon+ from the sidebar menu.
  2. Scroll down to the Google Cloud Platform (GCP) Project section. Select Change project.

To publish your Chat app to Google Chat, do the following

  1. From the Apps Script editor, get the deployment ID for the script by clicking Publish > Deploy from manifest.
  2. In the Deployments dialog box, click Get ID.
  3. In the Deployment ID dialog box, copy the value listed for the Deployment ID. Click Close and Close to dismiss the dialog boxes.
  1. From the Apps Script editor, get the deployment ID for the script by clicking on Deploy > New deployment (Top-right).
  2. Click the Select Deployment cog icon ++icon++ and select 'Add-on'.
  3. In the Description dialog box, type 'Initial deployment'.
  4. Click Deploy.
  5. Select Copy to copy the Deployment id and click Close.
    .. continue from item 4.

8.4. Under Functionality, select App can be messaged directly.

10.4. Under Functionality, select Receive one-to-one messages.

8.6. Under Permissions, select Specific people and groups in your domain. In the text box under the drop-down menu, enter your email address associated with your Google Workspace organization.

10.6. Under Permissions, select Specific people and groups in your domain. In the text box under the options menu, enter your email address associated with your Google Workspace organization.

8.7 Click Save changes.

10.7. Click Save.

After you save your changes, verify that the status on the Google Chat API page shows the App Status to be LIVE – available to users.

After you save your changes, verify that the status on the Google Chat API page shows the App Status to be LIVE – available to users at the top of the Configuration section of the page.

Test the Chat app

  1. Open Google Chat{:.external target="_blank"}.

Just a typo on this item at the end here.

  1. Open Google Chat.

Green note reads:

Note: The code for this Chat app logs the event objects received from Google Chat. You can look at the structure of the event objects by viewing the logs. To open the logs, in the Apps Script editor click View > Stackdriver Logging.

This section will trigger the ADDED_TO_SPACE event but will result in errors when a user adds a message to the chat because, at this stage in the tutorial, onMessage() had not been created yet. It might be a good idea to highlight this so that there is no confusion.

5. Define a card-formatted response

The GitHub code for Step-5 does not provide the global variables for the HEADER until Code 6, but it is displayed in the code lab and is required to run the sample at that stage.

Test the Chat app

You will need to create and deploy a new version of the current deployment here.

To test this app, simply go back to your direct message with the app in Google Chat and type a message (any message will do).

To test this app,

  1. Go back to the Apps Script Editor.
  2. Select Deployment > Manage deployments.
  3. Select the Edit pencil icon ++icon++ (Top-right of dialog) to update the Configuration.
  4. Change the Version drop-down to 'New version'.
  5. In the Description text input field type 'Update With Cards'.
  6. Click Deploy.
  7. Head back to Google Chat and type a message (any message will do).

6. React to button clicks in cards

Finally, you need to enable the Gmail Advanced Service in the project. To enable the Gmail API, do the following:

Needs a rewrite for new IDE.

  1. Click Resources > Advanced Google Services.
  2. In the list, find Gmail API and select on.
  3. Still in the dialog box, click the link Google Cloud Platform API Dashboard below that opens the Google Cloud Console.
  4. Click Enable APIs and Services.
  5. Search for ‘Gmail API' and click the Gmail API card.
  6. On the Gmail API page, click Enable.
  1. Select the plus button ++icon++ in Servies in the sidebar.
  2. In the list, find Gmail API and click to select it.
  3. Select Add.
  4. From the sidebar, select the Project Settings icon ++icon++
  5. Under the Google Cloud Platform (GCP) Project header select the Project number to open Google Cloud Console
  6. From the GCP console sidebar select Apis and services > Library
  7. Search for ‘Gmail API' and click the Gmail API card.
  8. On the Gmail API page, click Enable.
  9. Go back to the Apps Script Editor.
  10. Select Deployment > Manage deployments.
  11. Select the Edit pencil icon ++icon++ (Top-right of dialog) to update the Configuration.
  12. Change the Version drop-down to 'New version'.
  13. In the Description text input field type 'Include buttons'.
  14. Click Deploy.
  15. Head back to Google Chat and type a message (any message will do).

Note: If you are asked to provide access to the app, you may have to type your message a second time.

This probably needs expanding on. Also note, when authorisation is required the auth card does not pop into the chat and you must scroll down to see it.
Should the note also be in Green?

Note: On the first time you run the app, you may get a 'Attendance Bot requires configuration' warning message. This is because the app now accesses both the Calendar and Gmail APIs and needs the user's permission to access these scopes. Click Configure and authorise these scopes.

answer to all questions

Hi!
Should the bot only reply with the "away" card if i type "sick" and something else otherwise? right now i can type anything and get the same "Are you taking time off today?"

The API "chat.googleapis.com" doesn't exist or you don't have permission.

When enabling the Hangouts Chat API, everything is fine until I go into the Configuration tab. There an error message shows:

The API "chat.googleapis.com" doesn't exist or you don't have permission to access it
Tracking Number: 2258005293166415353

What's happening, and how can I fix this?

Issue with API

At page 4 of the Codelab I am trying to execute substep 8 onward

  1. Once the API is enabled, on the Hangouts Chat API page click the Configuration tab.
    Note: Ignore any messages asking you to create credentials.
  2. In the Configuration tab, do the following:

The problem is when I try to click on the Configuration tab I get the following message

https://s14.postimg.org/a6i8ijuv5/scr1.png

It says "The API "chat.googleapis.com" doesn't exist or you don't have permission to access it"

Bot works fine in a individual hangouts chat but in hansgouts chat groups does not work fine.

Bot works fine when i chat directly with the bot, but when i included the bot in a hangouts chat group sometimes works fine but many times when i click on block out day or Set vacation in Gmail but shows an error but do the task:

No es posible contactar con Attendance Bot. Inténtalo de nuevo más tarde.

It's not possible to contact Attendance Bot. Try again later.

This image show bot do the task but continue "processing":

image

After that:

image

Can you help me, thanks.

[SyncRepoSettings bot] - Invalid config file

Failed to validate the config schema at '.github/sync-repo-settings.yaml': [
{
"instancePath": "/permissionRules/1/permission",
"schemaPath": "#/properties/permissionRules/items/properties/permission/enum",
"keyword": "enum",
"params": {
"allowedValues": [
"pull",
"push",
"admin"
]
},
"message": "must be equal to one of the allowed values"
}
]

Schema can be found at https://github.com/googleapis/repo-automation-bots/blob/main/packages/sync-repo-settings/src/schema.json

Doesn't work

I followed 5. Define a card-formatted response, but it didn't work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.