0

I have an hello world alexa skill written in node js and deployed it in heroku. I have to use websockets to send the response to a web ui(say a html page in my local machine).Is this possible?

my server code-server.js

'use strict';

var AlexaAppServer = require( 'alexa-app-server' );

var server = new AlexaAppServer( {
 httpsEnabled: false,
 port: 8080
} );

server.start();

below is index.js

 module.change_code = 1;
  'use strict';

var alexa = require( 'alexa-app' );
var app = new alexa.app('Helloworld');


 app.launch( function( request, response ) {
console.log(app);
//console.log(request);
response.say( 'Welcome to Welcome to helloworld.' );

});

app.error = function( exception, request, response ) {
 console.log(exception)
 console.log(request);
 console.log(response); 
 response.say( 'Sorry an error occured ' + error.message);
};

app.intent('Helloworld',
{
 "slots":[]
 ,"utterances":[ 
    "hello alexa",
    "hi alexa",
    "how are you?"]
},
function(request,response) {

  response.say("welcome user");
//send this same response to a webpage using socket

}
);


module.exports = app;
jena84
  • 311
  • 1
  • 3
  • 20

1 Answers1

0

are you trying todo html page interactive with alexa . if yes you are right you have to use websocket , But you can try API gateway provided in AWS itself, In API gateway you can invoke it to your html page ,This link may help you somewhat . https://blog.prototypr.io/using-voice-commands-to-control-a-website-with-amazon-echo-alexa-part-1-6-a35edbfef405

  • Please add all relevant information to your answer. It might get useless if the content at the linked page changes – Nico Haase Mar 20 '18 at 15:02