Class: Messenger::MessengerController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/messenger/messenger_controller.rb

Instance Method Summary collapse

Instance Method Details

#subscribeObject



15
16
17
18
19
# File 'app/controllers/messenger/messenger_controller.rb', line 15

def subscribe
  render json: activate_bot
rescue RestClient::BadRequest
  render json: 'Invalid page access token'
end

#validateObject



5
6
7
8
9
10
11
12
13
# File 'app/controllers/messenger/messenger_controller.rb', line 5

def validate
  if verify_token_valid? && access_token_valid?
    render json: params["hub.challenge"]
  elsif !verify_token_valid?
    render json: 'Invalid verify token'
  else
    render json: 'Invalid page access token'
  end
end