Class: SpreeCmCommissioner::TelegramAlerts::IntegrationSyncFailure
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::TelegramAlerts::IntegrationSyncFailure
- Includes:
- Spree::ServiceModule::Base
- Defined in:
- app/services/spree_cm_commissioner/telegram_alerts/integration_sync_failure.rb
Instance Method Summary collapse
-
#call(error_message:, data: {}) ⇒ Object
Send Telegram alert for integration sync failure.
Instance Method Details
#call(error_message:, data: {}) ⇒ Object
Send Telegram alert for integration sync failure
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/services/spree_cm_commissioner/telegram_alerts/integration_sync_failure.rb', line 9 def call(error_message:, data: {}) chat_id = ENV.fetch('EXCEPTION_NOTIFIER_TELEGRAM_CHANNEL_ID', nil) return failure(nil, 'Telegram chat ID not configured') if chat_id.blank? telegram_client = ::Telegram.bots[:exception_notifier] return failure(nil, 'Telegram bot not configured') if telegram_client.blank? telegram_client.( chat_id: chat_id, parse_mode: 'HTML', text: (, data) ) success(message: 'Alert sent successfully') rescue StandardError => e failure(nil, "Failed to send Telegram alert: #{e.}") end |