Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send a Google Chat message in Python without Workspace account #118

Open
richlegrand opened this issue Jan 31, 2022 · 0 comments
Open

Send a Google Chat message in Python without Workspace account #118

richlegrand opened this issue Jan 31, 2022 · 0 comments

Comments

@richlegrand
Copy link

I'm trying to send a Google Chat message from Python in much the same way you can send a Gmail message:

https://developers.google.com/gmail/api/quickstart/python

I see documentation on how to create a Chat Bot (https://developers.google.com/chat/how-tos/bots-develop), but these typically require that you create your own https server that google can access.

I've tried using the scope 'https://www.googleapis.com/auth/chat', and it successfully goes through the authorization flow, and in particular the 'chat' scope claims to grant permissions to send messages, etc:

(see https://vizycam.com/wp-content/uploads/2022/01/Image-634-1.jpg)

I can build a request using build() and the granted credentials:

from googleapiclient.discovery import build
...
service = build('chat', 'v1', credentials=gcloud.creds())
and I can see that it has methods dms(), rooms(), spaces(), etc. that I could use to create a message, but I'm unable to get any requests to work.

Is it possible to send a chat message from a user account programmatically, in much the same way the Gmail example above does?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant