Class: SpreeCmCommissioner::TelegramAlerts::EventCreation
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::TelegramAlerts::EventCreation
- Includes:
- Spree::ServiceModule::Base
- Defined in:
- app/services/spree_cm_commissioner/telegram_alerts/event_creation.rb
Instance Method Summary collapse
-
#call(event:) ⇒ Object
Send Telegram alert for new event creation.
Instance Method Details
#call(event:) ⇒ Object
Send Telegram alert for new event creation
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/spree_cm_commissioner/telegram_alerts/event_creation.rb', line 8 def call(event:) chat_id = admin_chat_id return failure(nil, 'Telegram chat ID not configured') if chat_id.blank? SpreeCmCommissioner::TelegramNotificationSender.call( chat_id: chat_id, message: (event), parse_mode: 'HTML' ) success(message: 'Event alert sent successfully') rescue StandardError => e failure(nil, "Failed to send Telegram alert: #{e.}") end |