Skip to main content
Version: 4.x



You can install the package as usual via Composer:

composer require nutgram/nutgram

If you are using Laravel or Symfony frameworks, be sure to read their dedicated pages for a better development experience.


The framework can work out-of-the-box without much configuration, the only mandatory parameter is (obviously) the Telegram API token:

use SergiX44\Nutgram\Nutgram;

$bot = new Nutgram('you telegram token here');

In addition, it's possible to specify a list of options as second argument, like that:

use SergiX44\Nutgram\Nutgram;
use SergiX44\Nutgram\Configuration;

$config = new Configuration(
clientTimeout: 10, // default in seconds, when contacting the Telegram API

$bot = new Nutgram('you telegram token here', $config);

Here a list of all the options you can specify:


  • type: string
  • default: ''
  • Useful if you need to change to a local API server.


  • type: string
  • default: null
  • Useful when the bot is a group bot (with Group Privacy disabled) and you need to specify the bot name.


  • type: boolean
  • default: false
  • Enable the local mode when used along a self-hosted Telegram Bot API server.
    Nutgram will copy the file from your Telegram Bot API server instead downloading it.


  • type: callable(string $path): string
  • default: null
  • Useful if you need to remap a relative file path when used along is_local config.


  • type: boolean
  • default: false
  • Enable test environments useful when working with Web Apps.


  • type: integer
  • default: 5
  • In seconds, define the timeout when sending requests to the Telegram API.


  • type: string or instance
  • default: SergiX44\Nutgram\Cache\Adapters\ArrayCache
  • The object used to store conversation and data, must implements the PSR-16 CacheInterface.


  • type: array
  • default: []
  • An array of options for the underlying Guzzle HTTP client. Checkout the Guzzle documentation for further informations.


  • type: integer
  • default: 10
  • In seconds, define the timeout when polling updates from the Telegram API.


  • type: integer
  • default: 100
  • Define the maximum number of updates to be retrieved from the Telegram API.


  • type: array
  • default: ['message', 'edited_message', 'channel_post', 'edited_channel_post', 'inline_query', 'chosen_inline_result', 'callback_query', 'shipping_query', 'pre_checkout_query', 'poll', 'poll_answer', 'my_chat_member', 'chat_member', 'chat_join_request'];
  • Define the allowed updates to be retrieved from the Telegram API.