WebService::Mattermost::V4::Client - Perl websocket client for Mattermost.
version 0.23
This class connects to Mattermost via the WebSocket gateway and can either be extended in a child class, or used in a script.
use WebService::Mattermost::V4::Client; my $bot = WebService::Mattermost::V4::Client->new({ username => 'usernamehere', password => 'password', base_url => 'https://mattermost.server.com/api/v4/', # Optional arguments debug => 1, # Show extra connection information ignore_self => 0, # May cause recursion! }); $bot->on(message => sub { my ($bot, $args) = @_; # $args contains the decoded message content }); $bot->start(); # Add me last
See WebService::Mattermost::V4::Example::Bot.
Events are either available to be caught with on in scripts, or have methods which can be overridden in child classes.
on
gw_ws_started
The bot connected to the Mattermost gateway. Can be overridden as gw_ws_started().
gw_ws_started()
gw_ws_finished
The bot disconnected from the Mattermost gateway. Can be overridden as gw_ws_finished().
gw_ws_finished()
gw_message
The bot received a message. Can be overridden as gw_message().
gw_message()
gw_ws_error
The bot received an error. Can be overridden as gw_error().
gw_error()
gw_message_no_event
The bot received a message without an event (which is usually a "ping" item). Can be overridden as gw_message_no_event().
gw_message_no_event()
Mike Jones <mike@netsplit.org.uk>
This software is Copyright (c) 2020 by Mike Jones.
This is free software, licensed under:
The MIT (X11) License
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.