Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
<?php
declare(strict_types=1);
namespace App\Services\Social\Telegram;
/**
* Builds Telegram Bot API URLs from the configured token + host, so the
* `bot<token>/<method>` shape and config keys live in one place.
*/
class TelegramApi
{
public static function token(): string
{
return (string) config('trypost.platforms.telegram.bot_token');
}
/**
* Endpoint for a Bot API method, e.g. `https://api.telegram.org/bot<token>/sendMessage`.
*/
public static function endpoint(string $method): string
{
$base = self::baseUrl();
$token = self::token();
return "{$base}/bot{$token}/{$method}";
}
/**
* Download URL for a file path returned by `getFile`.
*/
public static function fileUrl(string $path): string
{
$base = self::baseUrl();
$token = self::token();
return "{$base}/file/bot{$token}/{$path}";
}
/**
* The bot's `t.me` link, or null while no bot username is configured.
*/
public static function botUrl(): ?string
{
$username = config('trypost.platforms.telegram.bot_username');
return filled($username) ? config('trypost.platforms.telegram.deep_link')."/{$username}" : null;
}
private static function baseUrl(): string
{
return config('trypost.platforms.telegram.api');
}
}