Created
October 10, 2016 17:55
-
-
Save zachfeldman/9b69d625a2f21a692a939fc2d50b590d to your computer and use it in GitHub Desktop.
Alexa-Web-Service Boilerplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'alexa_web_service' | |
require 'json' | |
before do | |
@data = request.body.read | |
begin | |
params.merge!(JSON.parse(@data)) | |
rescue JSON::ParserError | |
halt 400, "Bad Request" | |
end | |
@echo_request = AlexaWebService::AlexaRequest.new(JSON.parse(@data)) | |
@application_id = @echo_request.application_id | |
request.body.rewind | |
AlexaWebService::AlexaVerify.new(request.env, request.body.read) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment