Skip to content

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.

Group Telegram service classes under Services/Social/Telegram

Paulo Castellanob9fa8be513a7
diff --git a/app/Actions/SocialAccount/ConnectTelegramChannel.php b/app/Actions/SocialAccount/ConnectTelegramChannel.php
index 68d945be5..3743a1130 100644
--- a/app/Actions/SocialAccount/ConnectTelegramChannel.php
+++ b/app/Actions/SocialAccount/ConnectTelegramChannel.php
@@ -10,7 +10,7 @@ use App\Events\TelegramChannelConnected;
use App\Features\SocialAccountLimit;
use App\Models\SocialAccount;
use App\Models\Workspace;
-use App\Services\Social\TelegramApi;
+use App\Services\Social\Telegram\TelegramApi;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;
use Laravel\Pennant\Feature;
diff --git a/app/Actions/SocialAccount/RegisterTelegramWebhook.php b/app/Actions/SocialAccount/RegisterTelegramWebhook.php
index fbbd62062..68d12ddc1 100644
--- a/app/Actions/SocialAccount/RegisterTelegramWebhook.php
+++ b/app/Actions/SocialAccount/RegisterTelegramWebhook.php
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Actions\SocialAccount;
-use App\Services\Social\TelegramApi;
+use App\Services\Social\Telegram\TelegramApi;
use Illuminate\Support\Facades\Http;
use InvalidArgumentException;
use RuntimeException;
diff --git a/app/Http/Controllers/App/AnalyticsController.php b/app/Http/Controllers/App/AnalyticsController.php
index 084554b7f..aee64aad3 100644
--- a/app/Http/Controllers/App/AnalyticsController.php
+++ b/app/Http/Controllers/App/AnalyticsController.php
@@ -11,7 +11,7 @@ use App\Services\Social\FacebookAnalytics;
use App\Services\Social\InstagramAnalytics;
use App\Services\Social\LinkedInPageAnalytics;
use App\Services\Social\PinterestAnalytics;
-use App\Services\Social\TelegramAnalytics;
+use App\Services\Social\Telegram\TelegramAnalytics;
use App\Services\Social\ThreadsAnalytics;
use App\Services\Social\TikTokAnalytics;
use App\Services\Social\XAnalytics;
diff --git a/app/Http/Controllers/Auth/TelegramController.php b/app/Http/Controllers/Auth/TelegramController.php
index 329bf8a18..e24fa9cf6 100644
--- a/app/Http/Controllers/Auth/TelegramController.php
+++ b/app/Http/Controllers/Auth/TelegramController.php
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace App\Http\Controllers\Auth;
use App\Enums\SocialAccount\Platform as SocialPlatform;
-use App\Services\Social\TelegramConnectCode;
+use App\Services\Social\Telegram\TelegramConnectCode;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
diff --git a/app/Http/Controllers/Webhooks/TelegramWebhookController.php b/app/Http/Controllers/Webhooks/TelegramWebhookController.php
index c823a0722..d00e87177 100644
--- a/app/Http/Controllers/Webhooks/TelegramWebhookController.php
+++ b/app/Http/Controllers/Webhooks/TelegramWebhookController.php
@@ -8,7 +8,7 @@ use App\Actions\SocialAccount\ConnectTelegramChannel;
use App\Actions\SocialAccount\StoreTelegramReactions;
use App\Http\Controllers\Controller;
use App\Models\Workspace;
-use App\Services\Social\TelegramConnectCode;
+use App\Services\Social\Telegram\TelegramConnectCode;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
diff --git a/app/Jobs/PublishToSocialPlatform.php b/app/Jobs/PublishToSocialPlatform.php
index e163a90db..e4d494d19 100644
--- a/app/Jobs/PublishToSocialPlatform.php
+++ b/app/Jobs/PublishToSocialPlatform.php
@@ -25,7 +25,7 @@ use App\Services\Social\LinkedInPagePublisher;
use App\Services\Social\LinkedInPublisher;
use App\Services\Social\MastodonPublisher;
use App\Services\Social\PinterestPublisher;
-use App\Services\Social\TelegramPublisher;
+use App\Services\Social\Telegram\TelegramPublisher;
use App\Services\Social\ThreadsPublisher;
use App\Services\Social\TikTokPublisher;
use App\Services\Social\XPublisher;
diff --git a/app/Services/Post/PostMetricsFetcher.php b/app/Services/Post/PostMetricsFetcher.php
index 78a5bb550..de26dff94 100644
--- a/app/Services/Post/PostMetricsFetcher.php
+++ b/app/Services/Post/PostMetricsFetcher.php
@@ -13,7 +13,7 @@ use App\Services\Social\InstagramAnalytics;
use App\Services\Social\LinkedInPageAnalytics;
use App\Services\Social\MastodonAnalytics;
use App\Services\Social\PinterestAnalytics;
-use App\Services\Social\TelegramAnalytics;
+use App\Services\Social\Telegram\TelegramAnalytics;
use App\Services\Social\ThreadsAnalytics;
use App\Services\Social\XAnalytics;
use App\Services\Social\YouTubeAnalytics;
diff --git a/app/Services/Social/ConnectionVerifier.php b/app/Services/Social/ConnectionVerifier.php
index 400d079e4..79ea1d503 100644
--- a/app/Services/Social/ConnectionVerifier.php
+++ b/app/Services/Social/ConnectionVerifier.php
@@ -8,6 +8,7 @@ use App\Enums\SocialAccount\Platform;
use App\Exceptions\PlatformUnavailableException;
use App\Exceptions\TokenExpiredException;
use App\Models\SocialAccount;
+use App\Services\Social\Telegram\TelegramApi;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;
diff --git a/app/Services/Social/TelegramAnalytics.php b/app/Services/Social/Telegram/TelegramAnalytics.php
similarity index 97%
rename from app/Services/Social/TelegramAnalytics.php
rename to app/Services/Social/Telegram/TelegramAnalytics.php
index 35d5a0d41..9e0cdd714 100644
--- a/app/Services/Social/TelegramAnalytics.php
+++ b/app/Services/Social/Telegram/TelegramAnalytics.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace App\Services\Social;
+namespace App\Services\Social\Telegram;
use App\Models\PostPlatform;
use App\Models\SocialAccount;
diff --git a/app/Services/Social/TelegramApi.php b/app/Services/Social/Telegram/TelegramApi.php
similarity index 96%
rename from app/Services/Social/TelegramApi.php
rename to app/Services/Social/Telegram/TelegramApi.php
index 1d9d0dd5a..dbe5d412e 100644
--- a/app/Services/Social/TelegramApi.php
+++ b/app/Services/Social/Telegram/TelegramApi.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace App\Services\Social;
+namespace App\Services\Social\Telegram;
/**
* Builds Telegram Bot API URLs from the configured token + host, so the
diff --git a/app/Services/Social/TelegramConnectCode.php b/app/Services/Social/Telegram/TelegramConnectCode.php
similarity index 97%
rename from app/Services/Social/TelegramConnectCode.php
rename to app/Services/Social/Telegram/TelegramConnectCode.php
index fe34e23b9..c8ad463c0 100644
--- a/app/Services/Social/TelegramConnectCode.php
+++ b/app/Services/Social/Telegram/TelegramConnectCode.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace App\Services\Social;
+namespace App\Services\Social\Telegram;
use Carbon\CarbonInterface;
use Illuminate\Contracts\Encryption\DecryptException;
diff --git a/app/Services/Social/TelegramMediaType.php b/app/Services/Social/Telegram/TelegramMediaType.php
similarity index 95%
rename from app/Services/Social/TelegramMediaType.php
rename to app/Services/Social/Telegram/TelegramMediaType.php
index b4f192111..d7b881b32 100644
--- a/app/Services/Social/TelegramMediaType.php
+++ b/app/Services/Social/Telegram/TelegramMediaType.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace App\Services\Social;
+namespace App\Services\Social\Telegram;
use App\DataTransferObjects\MediaItem;
diff --git a/app/Services/Social/TelegramPublisher.php b/app/Services/Social/Telegram/TelegramPublisher.php
similarity index 98%
rename from app/Services/Social/TelegramPublisher.php
rename to app/Services/Social/Telegram/TelegramPublisher.php
index 997d1fb87..7a589da19 100644
--- a/app/Services/Social/TelegramPublisher.php
+++ b/app/Services/Social/Telegram/TelegramPublisher.php
@@ -2,13 +2,14 @@
declare(strict_types=1);
-namespace App\Services\Social;
+namespace App\Services\Social\Telegram;
use App\DataTransferObjects\MediaItem;
use App\Exceptions\Social\TelegramPublishException;
use App\Models\PostPlatform;
use App\Models\SocialAccount;
use App\Services\Social\Concerns\HasSocialHttpClient;
+use App\Services\Social\ContentSanitizer;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Collection;
diff --git a/tests/Feature/Services/Social/TelegramAnalyticsTest.php b/tests/Feature/Services/Social/TelegramAnalyticsTest.php
index cfd215a1e..e3fb80476 100644
--- a/tests/Feature/Services/Social/TelegramAnalyticsTest.php
+++ b/tests/Feature/Services/Social/TelegramAnalyticsTest.php
@@ -5,7 +5,7 @@ declare(strict_types=1);
use App\Enums\SocialAccount\Platform;
use App\Models\PostPlatform;
use App\Models\SocialAccount;
-use App\Services\Social\TelegramAnalytics;
+use App\Services\Social\Telegram\TelegramAnalytics;
use Illuminate\Support\Facades\Http;
beforeEach(function () {
diff --git a/tests/Feature/Services/Social/TelegramPublisherTest.php b/tests/Feature/Services/Social/TelegramPublisherTest.php
index 43be60be4..7e50ceb55 100644
--- a/tests/Feature/Services/Social/TelegramPublisherTest.php
+++ b/tests/Feature/Services/Social/TelegramPublisherTest.php
@@ -10,7 +10,7 @@ use App\Models\PostPlatform;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
-use App\Services\Social\TelegramPublisher;
+use App\Services\Social\Telegram\TelegramPublisher;
use Illuminate\Support\Facades\Http;
beforeEach(function () {
diff --git a/tests/Feature/Social/TelegramConnectionTest.php b/tests/Feature/Social/TelegramConnectionTest.php
index 767f43757..198b4ddf5 100644
--- a/tests/Feature/Social/TelegramConnectionTest.php
+++ b/tests/Feature/Social/TelegramConnectionTest.php
@@ -11,7 +11,7 @@ use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
use App\Services\Social\ConnectionVerifier;
-use App\Services\Social\TelegramConnectCode;
+use App\Services\Social\Telegram\TelegramConnectCode;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Storage;
diff --git a/tests/Unit/Services/Social/TelegramApiTest.php b/tests/Unit/Services/Social/TelegramApiTest.php
index bcab8ef56..8ae35841b 100644
--- a/tests/Unit/Services/Social/TelegramApiTest.php
+++ b/tests/Unit/Services/Social/TelegramApiTest.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-use App\Services\Social\TelegramApi;
+use App\Services\Social\Telegram\TelegramApi;
beforeEach(function () {
config([