Module: TeleNotify::Controller

Defined in:
lib/tele_notify/telegram_controller.rb

Instance Method Summary collapse

Instance Method Details

#webhookObject



3
4
5
6
7
8
9
10
11
# File 'lib/tele_notify/telegram_controller.rb', line 3

def webhook
  if params[:message]
    user = TelegramUser.create( { telegram_id: params[:message][:from][:id], first_name: params[:message][:from][:first_name] } )
    if user
      user.send_message("Notifications are now active. To cancel, stop this bot in Telegram.")
    end
    render :nothing => true, :status => :ok
  end
end