Bot::ChatBots::Telegram - Telegram adapter for Bot::ChatBots


This document describes Bot::ChatBots::Telegram version 0.014.

Build Status Perl Version Current CPAN version Kwalitee CPAN Testers CPAN Testers Matrix


   # A minimal Telegram Bot using WebHooks
   use Log::Any qw< $log >;
   use Log::Any::Adapter;
   use Mojolicious::Lite;
   Log::Any::Adapter->set(MojoLog => logger => app->log);
   plugin 'Bot::ChatBots::Telegram' => instances => [
         processor  => \&processor,
         register   => 1,
         token      => $ENV{TOKEN},
         unregister => 1,
         url        => '',
      # more can follow here...
   sub processor {
      my $record = shift;
      # do whatever you want with $record, e.g. set a quick response
      $record->{send_response} = 'your thoughs are important for us!';
      return $record;

   # You can also add Bot::ChatBots::Telegram::LongPoll sources if you want


This module allows you to to define Bot::ChatBots for Telegram, a messaging application. For an introduction and tutorial, see Bot::ChatBots::Telegram::Guide::Tutorial.

Strictly speaking, this module is a Mojolicious plugin that allows you to load and use Bot::ChatBots::Telegram::WebHook (see "SYNOPSIS" for a quick example). On the other hand, the distribution also contains other modules that allow you to interact with Telegram, e.g. Bot::Chatbots::Telegram::LongPoll.

These modules rely upon Log::Any for emitting logging information; you are encouraged to read that module's documentation for further information. For what we are concerned, you have to remember that all logs will be lost unless you configure Log::Any, e.g. to send messages on standard output you can do this:

   use Log::Any::Adapter qw< Stderr >;

If using the web hook, then you will probably want to send the logs together with Mojolicious's logs, like this:

   use Mojolicious::Lite;
   use Log::Any::Adapter;
   Log::Any::Adapter->set(MojoLog => logger => app->log);

The configuration above relies on the presence of Log::Any::Adapter::MojoLog.


All the heavylifting is done by Bot::ChatBots::MojoPlugin.


Report bugs through GitHub (patches welcome).


Bot::ChatBots, Bot::ChatBots::Telegram::WebHook, Bot::ChatBots::Telegram::LongPoll, WWW::Telegram::BotAPI.


Flavio Poletti <>


Copyright (C) 2016, 2018 by Flavio Poletti <>

This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.