Skip to content

Conversation

@4ranklyn
Copy link

No description provided.

4ranklyn and others added 11 commits June 14, 2025 18:25
This commit introduces a new feature that sends notifications to specific Telegram groups when a new ticket is created.

Key changes include:
- Added `telegram_group_id` to the `units` table and `telegram_username` and `telegram_user_id` to the `users` table.
- Created a `TelegramService` to handle all interactions with the Telegram API.
- Implemented a `TelegramController` to handle incoming webhooks and automatically register group IDs.
- Added an event listener (`SendTelegramNotification`) that triggers when a new ticket is created, sending a formatted message to the appropriate group and mentioning the responsible user.
- Included comprehensive documentation on how to set up and use the new feature.
Implement Telegram Group-Based Notifications
The Telegram webhook route now accepts both GET and POST requests. This is necessary because Telegram sends a GET request to verify the webhook URL before sending POST requests with updates.

This change resolves the "Method Not Allowed" error that occurs during webhook setup.
This commit introduces a manual, event-driven system for sending Telegram notifications when a new ticket is created.

Due to environmental constraints where `php` and `composer` are not available, this implementation avoids external packages and instead leverages Laravel's built-in `Http` client.

Key changes include:
- A new `TelegramService` class to encapsulate all communication with the Telegram Bot API.
- The `TicketCreated` event and `SendNewTicketNotification` listener to handle the notification logic asynchronously.
- Configuration in `config/services.php` for the Telegram bot token.
- Correct event-listener mapping in `EventServiceProvider`.
- Verification that the `TicketCreated` event is already dispatched from the `CreateTicket` Filament page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants