Need to print the Alexa request/response in file

amazon-alexa

#1

I would like to print or write to log file the request / response that we get from alexa show device. Can anyone help with code to print to log file?


#2

We haven’t added something like this yet, but you can access the request with this.$request and the response with this.$response.

For example, you could use hooks to access these objects in the request.end and response.end middlewares.

Here is an example that uses console.log (replace with your desired operation to write into a file):

// src/app.ts

app.hook('request.end', (jovo) => {
  console.log(jovo.$request);
});