NAME

Net::Gotify - Gotify client for Perl

SYNOPSIS

use Net::Gotify;

my $gotify = Net::Gotify->new(
    base_url     => 'http://localhost:8088',
    app_token    => '<TOKEN>',
    client_token => '<TOKEN>',
    logger       => $logger
);

my $msg = eval {
  $gotify->create_message(
      title    => 'Backup',
      message  => '**Backup** was successfully finished.',
      priority => 2,
      extras   => {
          'client::display' => {contentType => 'text/markdown'}
      }
  )
};

if ($@) {
  say $@->description;
}

my @messages = $gotify->get_messages();

foreach my $msg (@messages) {
  say sprintf "[#%d] %s\n%s", $msg->id, $msg->title, $msg->message;
}

DESCRIPTION

Net::Gotify allows you to interact with Gotify server via Perl.

https://gotify.net/

Gotify API

new

$gotify = Net::Gotify->new( \%params );

Create a new instance of Net::Gotify.

Parameters:

  • base_url, Gotify base URL

  • app_token, Application token

  • client_token, Client token

  • verify_ssl, Enable SSL/TLS certificate check

  • logger, Logger instance (Log::Any, Mojo::Log, etc.)

my $gotify = Net::Gotify->new(
    base_url     => 'http://localhost:8088',
    app_token    => '<TOKEN>',
    client_token => '<TOKEN>',
    logger       => $logger
);

request

$res = $gotify->request( \%params );

Send a RAW HTTP request to Gotify.

Parameters:

  • method, Request method

  • token_type, Token type (default: client)

  • path, Request path

  • data, Request data (HASH)

  • options, Request options (HASH)

$res = $gotify->request( method     => 'POST', path => '/message',
                         token_type => 'app',  data => \%data );

Message API

create_message

$message = $gotify->create_message( message  => $message );

$message = $gotify->create_message( message  => $message,  title  => $title,
                                    priority => $priority, extras => \%extras );

Create a message and return the Net::Gotify::Message object.

Pameters:

  • message, Notify nessage (required)

  • title, Message title

  • priority, Message priority

  • extras, Message extras

Simple notification:

$gotify->create_message( message => 'Job completed!' );

Notification with title and markdown:

$gotify->create_message(
    title    => 'Backup',
    message  => '**Backup** was successfully finished.',
    priority => 2,
    extras   => {
        'client::display' => {contentType => 'text/markdown'}
    }
);

delete_message

$gotify->delete_message ( $message_id );

Delete a single message.

delete_messages

$gotify->delete_messages( \%params );

$gotify->delete_messages( app_id => $application_id );

Delete all messages.

Parameters:

  • app_id, Application ID

get_messages

$array = $gotify->get_messages( \%params );

$array = $gotify->get_messages( app_id => $application_id, 
                                limit  => $limit,  since => $since );

Fetch all messages and return an ARRAY of Net::Gotify::Message objects.

Parameters:

  • app_id, Application ID

  • limit, Result limit (default: 100), the maximal amount of messages to return

  • since, return all messages with an ID less than this value

my @messages = $gotify->get_messages();

foreach my $msg (@messages) {
    say sprintf "[#%d] %s\n%s", $msg->id, $msg->title, $msg->message;
}

Client API

get_clients

$gotify->get_clients( );

Fetch all clients and return an array of Net::Gotify::Client objects.

create_client

$gotify->create_client( \%params );

Create a client and return the Net::Gotify::Client object.

Parameters:

  • name, Client name (required)

update_client

$gotify->update_client( $client_id, \%params );

Update a client and return the Net::Gotify::Client object.

Parameters:

  • name, Client name (required)

delete_client

$gotify->delete_client( $client_id );

Delete a client.

Application API

get_applications

$gotify->get_applications( );

Fetch all applications and return an array of Net::Gotify::Application objects.

create_application

$gotify->create_application( \%params );

Create an application and return the Net::Gotify::Application object.

Parameters:

  • name, Application name (required).

  • description, Application description.

  • default_priority, Default application priority (default: 0).

update_application

$gotify->update_application( $app_id, \%params );

Update an application and return the Net::Gotify::Application object.

  • name, Application name (required).

  • description, Application description.

  • default_priority, Default application priority (default: 0).

delete_application

$gotify->delete_application( $app_id );

Delete an application.

update_application_image

TODO - Method not implemented.

delete_application_image

TODO - Method not implemented.

Plugin API

get_plugins

$gotify->get_plugins( );

Fetch all plugins and return an array of Net::Gotify::Plugin objects.

get_plugin_config

TODO - Method not implemented.

update_plugin_config

TODO - Method not implemented.

enable_plugin

$gotify->enable_plugin( );

Enable a plugin.

disable_plugin

$gotify->disable_plugin( );

Disable a plugin.

get_plugin

TODO - Method not implemented.

User API

current_user

$gotify->current_user;

Return the current user and return Net::Gotify::User object.

update_current_user_password

$gotify->update_current_user_password( $password );

Update the password of the current user.

get_users

$gotify->get_users ( \%params );

Fetch all users and return an ARRAY of Net::Gotify::User objects.

create_user

$gotify->create_user( name => $name, pass => $pass, admin => $flag );

Create a user and return Net::Gotify::User object.

Parameters:

  • name, User name

  • pass, User password

  • admin, Admin flag

get_user

$gotify->get_user( $user_id );

Get a user and return Net::Gotify::User object.

update_user

delete_user

$gotify->delete_user( $user_id );

Delete a user.

SUPPORT

Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at https://github.com/giterlizzi/perl-Net-Gotify/issues. You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

https://github.com/giterlizzi/perl-Net-Gotify

git clone https://github.com/giterlizzi/perl-Net-Gotify.git

AUTHOR

  • Giuseppe Di Terlizzi <gdt@cpan.org>

LICENSE AND COPYRIGHT

This software is copyright (c) 2025 by Giuseppe Di Terlizzi.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.