1.8 KiB
Go Google Space Bot
A simple Go application to send messages to a Google Chat space using its webhook URL.
Prerequisites
To use this application, ensure you have the following installed:
- Go version
1.23
or later. - A properly configured
.env
file with the following variables:SPACE_ID
: The ID of the Google Chat space you want to send messages to.KEY
: The key provided in your Google Chat webhook URL.TOKEN
: The token provided in your Google Chat webhook URL.
For more info on setting up Google Chat webhooks, see Sending Chat messages using webhooks.
Installation
Clone this repository, navigate into the directory, and build the project:
git clone <repository-url>
cd go-google-space
go build -o go-google-space
Configuration
Create a .env
file in the root directory with the following contents:
SPACE_ID=<your-space-id>
KEY=<your-key>
TOKEN=<your-token>
Replace <your-space-id>
, <your-key>
, and <your-token>
with the respective values from your Google Chat webhook URL.
Usage
Run the built executable, passing the message you want to send as an argument:
./go-google-space "Hello, Google Chat!"
Example Output
When the command runs successfully, the message will appear in your configured Google Chat space.
If any errors occur (e.g., if the .env
file is missing or the webhook URL configuration is incorrect), error messages will be displayed in the terminal.
Dependencies
This project uses the following dependencies:
- godotenv for loading environment variables from a
.env
file.
To install the dependency, run:
go get github.com/joho/godotenv
License
This project is licensed under the MIT License. See the LICENSE file for details.