You can send messages to Google chat rooms by invoking Google API with necessary permissions. This will guide you to send such messages to Google chat rooms simply using a 'curl' command.
Prerequisites
- Webhook URL for a Google chat room.
- Access to a terminal with 'curl' installed.
Steps to be followed
1. Generate a webhook URL for the required Google chat room.
- Click on the chat room name and select Manage webhooks.
- Provide a name to the Webhook in the Name field. Then, click on Save. (Avatar URL is optional and you can put a link to an icon that you need to show as the sender's avatar)
- Once the URL is generated, copy the URL.
- Then use the following code snippet to send the message to the chat room.
GOOGLE_CHAT_URL="<copied-url>"
curl \
-X POST \
-H 'Content-Type: application/json' \
"${GOOGLE_CHAT_URL}" \
-d '{"text": "Hello from Witcentre!"}'
You can see a new chat in your chat room. Following is a sample message received.
Post A Comment:
0 comments: