WebService::Mattermost::V4::Example::Bot
An example Mattermost WebSocket bot using WebService::Mattermost. The bot connects to the network, and responds to "Ping" messages with "Pong".
WebService::Mattermost
#!/usr/bin/env perl use strict; use warnings; use WebService::Mattermost::V4::Example::Bot; my $bot = WebService::Mattermost::V4::Example::Bot->new({ username => 'usernamehere', password => 'passwordhere', base_url => 'https://my.mattermost.server.com/api/v4/' debug => 1, # optional })->start();
The gw_ methods in this class are events emitted by WebService::Mattermost::V4::Client. Each one has one argument passed which is a HashRef of decoded data from the Mattermost server.
gw_
WebService::Mattermost::V4::Client
gw_ws_started()
Triggered when the bot connects to the Mattermost gateway.
gw_ws_finished()
Triggered when the connection to the gateway closes.
gw_message()
Triggered when a message with an event is received from the gateway.
gw_ws_error()
Triggered when an error is received from the gateway.
gw_message_no_event()
Triggered when a message without an event is received from the gateway.
Mike Jones email:mike@netsplit.org.uk
To install WebService::Mattermost, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::Mattermost
CPAN shell
perl -MCPAN -e shell install WebService::Mattermost
For more information on module installation, please visit the detailed CPAN module installation guide.