0
votes

I'm trying to create Alexa skill based on the tutorial mentioned here. I'm creating this using Alexa-Hosted Skill. When I open my skill, instead of saying 'hello', I get an error saying "There was a problem with the requested skill's response"

The code is exactly the same as mentioned in the src directory of the GitHub repo. Please let me know if you still need to see it and I can paste it here.

I have 2 questions:

  1. I tried to find what the :ask and :tell directives are but I couldn't find the documentation. I checked a couple of sample repos provided by Alexa (like these: fact skill, trivia skill, how to skill) but every sample created skill using ResponseBuilder which is kind of documented here but I didn't find the documentation extensive. Can someone please tell me what they are and where can I find more documentation about them?

  2. How do I correct the error I am getting so that I will be able to play the audio?

1

1 Answers

1
votes

alexa-sdk package which is used in the mentioned GitHub repo is deprecated and you shouldn't use it.

You should use alexa-sdk-core.

If you wish to play the audio, then you can create the intent handler as below in the code editor of your Alexa Skill,

const PlayAudioIntent = {
    canHandle(handlerInput) {
        return handlerInput.requestEnvelope.request.type === 'IntentRequest'
            && handlerInput.requestEnvelope.request.intent.name === 'PlayAudioIntent';
    },
    handle(handlerInput) {
        const audioFile = '<audio src="https://s3.amazonaws.com/cdn.dabblelab.com/audio/one-small-step-for-man.mp3" />';
        const speechText = `Hello ${audioFile}`;
        return handlerInput.responseBuilder
            .speak(speechText)
            //.reprompt('add a reprompt if you want to keep the session open for the user to respond')
            .getResponse();
    }
};