Skip to content

Instantly share code, notes, and snippets.

@zachfeldman
Created October 10, 2016 17:55
Show Gist options
  • Save zachfeldman/9b69d625a2f21a692a939fc2d50b590d to your computer and use it in GitHub Desktop.
Save zachfeldman/9b69d625a2f21a692a939fc2d50b590d to your computer and use it in GitHub Desktop.
Alexa-Web-Service Boilerplate
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