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

[Feature Request] Add Hangouts Chat API functions #74

Closed
scrthq opened this issue Jul 7, 2018 · 2 comments
Closed

[Feature Request] Add Hangouts Chat API functions #74

scrthq opened this issue Jul 7, 2018 · 2 comments
Assignees

Comments

@scrthq
Copy link
Member

scrthq commented Jul 7, 2018

Docs: https://developers.google.com/hangouts/chat/reference/

The functions added to PSGSuite specifically for this would provide REST API functionality only, but would allow actions like posting messages to rooms/DM's/etc, wherever webhooks are set up in Chat.

@scrthq scrthq self-assigned this Jul 7, 2018
@scrthq
Copy link
Member Author

scrthq commented Jul 10, 2018

This is now working in local, both with Webhooks and with the .NET SDK for Hangouts Chat.

Tidying up the last few issues to get the pipeline working the way I want it to and finishing up the documentation around this as well. Once done, this will be getting pushed up as a new release 😃


Webhook Notes

Webhooks are the most straightforward as far as additional setup is concerned. Specifically, you don't need to even have a PSGSuite config set up first in order to use Webhooks, since the Webhook URL contains the auth token already once generated.

The downsides to using Webhooks are that...

  1. they are Room (Space) specific, so you need a unique Webhook per Space you'd like to post messages to, and...
  2. they only allow posting messages into Hangouts Chat

Some additional functionality has been added to allow storage of encrypted Webhooks in the PSGSuite config directly via dictionary/hashtable. This allows you to use the hash key in your scripts as $hook with Send-GSChatMessage -Webhook $hook so you don't expose the Webhook in your script itself.

SDK Notes

Going the SDK route requires a few more steps to get set up. You'll need to add the Chat API to your project and configure it, which includes specifying a bot endpoint that is either:

  • Public API endpoint URL to send bot messages to
    • If using PSGSuite to handle the logic around message handling, this requires some additional routing logic in your infrastructure to enable
    • This would provide the only way to really respond back to messages sent to the bot directly with PSGSuite, assuming your API server is running PSGSuite itself and the POST to the API triggers the PowerShell backend
  • Google Apps Script deployment ID
    • This would be the only truly free option, as G Suite users already have access to Apps Script and other Google Services like it
    • This could possibly use Google Sheets as a sort of message queue and log for the bot, with a local instance of PSGSuite running in a loop and polling the Sheet for new messages every few seconds. I will be building a POC of this approach and adding to the documentation of it works as expected.
  • a Google Cloud Pub/Sub endpoint
    • Requires a Google Cloud Platform subscription
    • Requires additional logic to poll the Pub/Sub endpoint that is not yet built out in PSGSuite
    • Can be costly if you aren't careful with your polling settings, as each request counts, even if it there aren't any new messages to grab from the queue

@scrthq
Copy link
Member Author

scrthq commented Jul 21, 2018

added in v2.12.0

@scrthq scrthq closed this as completed Jul 21, 2018
@ghost ghost removed the work in progress label Jul 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant