Class: Spree::Api::Webhook::TelegramBotsController
- Inherits:
-
BaseController
- Object
- V2::ResourceController
- BaseController
- Spree::Api::Webhook::TelegramBotsController
- Defined in:
- app/controllers/spree/api/webhook/telegram_bots_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/spree/api/webhook/telegram_bots_controller.rb', line 8 def create chat_id = params.dig(:message, :chat, :id) text = params.dig(:message, :text) if text == '/start' && chat_id.present? (chat_id) head :ok else head :unprocessable_entity end end |
#send_message_to_user_in_queue(chat_id) ⇒ Object
20 21 22 23 24 25 |
# File 'app/controllers/spree/api/webhook/telegram_bots_controller.rb', line 20 def (chat_id) SpreeCmCommissioner::TelegramStartMessageSenderJob.perform_later( chat_id: chat_id, telegram_bot_id: @telegram_bot.id ) end |