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);
use App\Services\Social\Telegram\TelegramApi;
beforeEach(function () {
config([
'trypost.platforms.telegram.bot_token' => 'TESTTOKEN',
'trypost.platforms.telegram.api' => 'https://api.telegram.org',
]);
});
it('builds a method endpoint from the token and host', function () {
expect(TelegramApi::endpoint('sendMessage'))
->toBe('https://api.telegram.org/botTESTTOKEN/sendMessage');
});
it('builds a file download url', function () {
expect(TelegramApi::fileUrl('photos/file_1.jpg'))
->toBe('https://api.telegram.org/file/botTESTTOKEN/photos/file_1.jpg');
});
it('builds the endpoint from a host configured with a trailing slash', function () {
config(['trypost.platforms.telegram.api' => data_get(trypostConfigWith(['TELEGRAM_API' => 'https://api.telegram.org/']), 'platforms.telegram.api')]);
expect(TelegramApi::endpoint('getChat'))
->toBe('https://api.telegram.org/botTESTTOKEN/getChat');
});
it('links to the bot from the deep link host and the bot username', function () {
config(['trypost.platforms.telegram.bot_username' => 'TryPostBot']);
expect(TelegramApi::botUrl())->toBe(config('trypost.platforms.telegram.deep_link').'/TryPostBot');
});
it('has no bot link while no bot username is configured', function () {
config(['trypost.platforms.telegram.bot_username' => null]);
expect(TelegramApi::botUrl())->toBeNull();
});