Class: MessageQuickly::WebhooksController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- MessageQuickly::WebhooksController
- Defined in:
- app/controllers/message_quickly/webhooks_controller.rb
Instance Method Summary collapse
Instance Method Details
#callback ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/controllers/message_quickly/webhooks_controller.rb', line 14 def callback json = JSON.parse(request.body.read) ProcessMessengerCallbackJob.perform_later(json) render nothing: true, status: 200 rescue JSON::ParserError => e render plain: 'Error processing callback', status: 500 end |
#verify ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/controllers/message_quickly/webhooks_controller.rb', line 6 def verify if params['hub.verify_token'] == ENV['FACEBOOK_MESSENGER_VERIFICATION_TOKEN'] render plain: params['hub.challenge'], status: 200 else render plain: 'Wrong validation token', status: 500 end end |