π Telegram Notifications (Admin Actions)
The telegram/notifications feature handles interactive admin actions in Telegram, such as approving or rejecting bookings. It works in tandem with the redis/notifications feature, which provides the initial message.
πΊοΈ Module Map
π feature_setting.py
class NotificationsStates(StatesGroup):
main = State()
STATES = NotificationsStates
GARBAGE_COLLECT = True
MENU_CONFIG = {
"key": "notifications",
"text": "β¨ Notifications",
"priority": 50,
"is_admin": True,
}
π Logic Flow (Approval)
- Admin Clicks βApproveβ: Telegram sends a callback to the bot.
- Orchestrator: Calls
NotificationsService.confirm_appointment.
- Service: Sends request to Django API; enqueues
send_appointment_notification in ARQ.
- UI: Updates Telegram message to show βApprovedβ with delivery status indicators.
π Logic Flow (Rejection)
- Admin Clicks βRejectβ: Bot shows a menu of reasons (Busy, Ill, No Materials, etc.).
- Admin Selects Reason: Bot calls
cancel_appointment with the specific reason code.
- Service: Updates Django and enqueues a cancellation notification job.
- UI: Updates message to show βRejectedβ with the chosen reason.