SYNOPSIS
use Google::Chat::WebHooks;
my $room = Google::Chat::WebHooks->new(room_webhook_url => 'https://chat.googleapis.com/v1/spaces/someid/messages?key=something&token=something');
my $result = $room->simple_text("This is a message");
$result = $room->simple_text("Message with some *bold*");
DESCRIPTION
Google::Chat::WebHooks - Send notifications to Google Chat Rooms as provided by G-Suite. Does not work with Google Hangouts as used with your free Google account. Cannot receive messages - for that you need a bot. I'm sure I'll write that module some day.
USAGE
Just create an object, passing the webhook URL of the room to which you want to send notifications. Then fire away. If you need help setting up a webhook for your room, see https://developers.google.com/hangouts/chat/how-tos/webhooks.
- new(room_webhook_url => value)
- new(room_webhook_url => value, timeout => integer)
-
Create a new instance of this class, passing in the webhook URL to send messages to. This argument is mandatory. Failure to set it upon creation will result in the method croaking.
Optionally also set the connect timeout in seconds. Default value is 10.
- simple_message(string)
-
my $result = $room->simple_text("This is a message"); $result->{'result'}; # 1 if success, 0 if not $result->{'message'}; # "success" if result was 1, error message if not
Send a message to the room. Basic formatting is available. Returns a hash ref.
- room_webhook_url(), room_webhook_url(value)
-
Get/set the URL of the room.
BUGS & SUPPORT
Please log them on GitHub.
AUTHOR
I Gibbs
CPAN ID: IGIBBS
igibbs@cpan.org
https://github.com/realflash/perl-google-chat-webhoooks
COPYRIGHT
This program is free software licensed under the...
The General Public License (GPL)
Version 3
The full text of the license can be found in the LICENSE file included with this module.