Giter Club home page Giter Club logo

alexa-skills-kit-sdk-for-java's People

Contributors

abhipwr avatar abhjroy avatar ask-sdk avatar ayoubabid avatar breedloj avatar chris-liao avatar daltonhuynh avatar dependabot[bot] avatar doiron avatar gjkamstra avatar jaferkhan avatar joshbean avatar kinisoftware avatar kkocel avatar memodoring avatar nikhilym avatar pbheemag avatar prakshai avatar pranotipp avatar rahulawl avatar rommeltj avatar ronwang avatar sattpat avatar sdelamo avatar shenchen93 avatar shreyas-vgr avatar sungolivia avatar thepriteshsoni avatar tkm22 avatar xavidop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alexa-skills-kit-sdk-for-java's Issues

Dialog Delegate: Switching the Intent during fulfilling slots

Hello,

I'm using the Dialog Model to fulfill the required slots of the intents in my java lambda function.

I have similar slots in some intents and I would like to use the same utterances to fulfill theses slots.

Now, If a User has to fulfill the required slots of one intent, sometimes the skill detect an other intent during this process (Because some utterances are similar to other intents).

Is it possible to force the skill to stay in one intent until all required slots are fulfilled or I'm doing something wrong?

Here my code, which I'm using:

    //Get Dialog State
    DialogState dialogueState = request.getDialogState();    	
if (dialogueState.equals(DialogState.STARTED)) {
	System.out.println("In if");
	isDialog = true;
	// 1. Create DialogIntent based on your original intent
        DialogIntent dialogIntent = new DialogIntent(intent);
       
        // 2. Create Directive
        DelegateDirective dd = new DelegateDirective();
        dd.setUpdatedIntent(dialogIntent);
        
        List<Directive> directiveList = new ArrayList<Directive>();
        directiveList.add(dd);
        
        SpeechletResponse speechletResp = new SpeechletResponse();
        speechletResp.setDirectives(directiveList);
       
        // 3. return the response.
        speechletResp.setNullableShouldEndSession(false);
        return speechletResp;
    } else if (dialogueState.equals(DialogState.COMPLETED)) {
    	isDialog = false;
    	log.info("onIntent, inside dialogueState IF statement");
    	Message message = new Message();
    	String speechText = "";
    	String repromptSpeech = "Kann ich dir noch anderweitig behilflich sein?";

    	String m = intent.getSlot(_MESSAGETEXT).getValue();  
    	
    	message.setMessage(m);
    	
    	// message.setMessage(intent.getSlot(_MESSAGETEXT).getValue());
    	System.out.println("Message Text: " + m);
    	
    	String firstname = intent.getSlot(_USERFIRSTNAME).getValue().toLowerCase();
    	String lastname = intent.getSlot(_USERLASTNAME).getValue().toLowerCase();        	

    	String receiverUserId = "";

    	if(db.checkIfUserExistsByName(firstname, lastname)) {
    		receiverUserId = db.getUserIDByName(firstname, lastname);
    	}else {
    		speechText = "Der angegebene Empfänger existiert leider nicht! Bitte probiere es erneut!";
    		return getSpeechletResponse(speechText, "", true);
    	}

    	// Check if the receiver is the same like the current user
    	if(receiverUserId.equals(user.getUserID())) {
    		speechText = "Ich glaube nicht, dass du dir selbst eine Nachricht schicken willst.";
    		return getSpeechletResponse(speechText, "", true);
    	}else {
    		message.setUserID(receiverUserId);
    		message.setCreator(user.getUserID());
    		message.setStatus(MessageStatus.UNREAD.toString());
    		message.setDate(DateParser.getDateOfTodayAsString());

    		db.addMessage(message);

    		speechText = "Die Nachricht wurde erfolgreich an " + firstname + " " + lastname + " geschickt!";
    	}

		return getSpeechletResponse(speechText, repromptSpeech, true);
    } else {
    	log.info("onIntent, inside dialogueState ELSE statement");
        DelegateDirective dd = new DelegateDirective();

        List<Directive> directiveList = new ArrayList<Directive>();
        directiveList.add(dd);

        SpeechletResponse speechletResp = new SpeechletResponse();
        speechletResp.setDirectives(directiveList);
        speechletResp.setNullableShouldEndSession(false);
        return speechletResp;
    }

Greetings,

Michael

Found lot of JavaProblems errors in download and import

Hi Amazon ASK Java Team,

Imported the code into eclipse and converted into maven projects and ran the maven install on the downloaded project. Found lot of java problems including library missing in many of the modules in scorekeeper, Tidepooler, httpcore modules missing and so on.

Thanks,
Gubendran

Getting device ID

Just was wondering if it's possible to get a device id in some way using this SDK? Something like context.System.device.deviceId

Thanks

No public method named found

While tesing lamda function getting below error
"errorMessage": "No public method named HelloWorldSpeechletRequestStreamHandler with appropriate method signature found on class class helloworld.HelloWorldSpeechletRequestStreamHandler"

Thanks

maven build error

Hi, I have downloaded the github repository for the the java alexa starter kit as a zip to my local drive,
and have unzipped it.

If I goto the samples directory, and - using my maven 3.3.9 installation - run the command:

mvn assembly:assembly -DdescriptorId=jar-with-dependencies package

then I do get a lot of compilation errors (see error.txt attachment).
error.txt

If I go to the root directory, where there is also a pom.xml, then everything works fine, but the file
alexa-skills-kit-samples-1.0-jar-with-dependencies.jar does not contain the packages from the samples.

Can anybody provide me a solution (or workaround) to this?

thx

Resolutions from Slot

Can not find a way to get the Resolutions from a Slot object! Ther is no function like getResolution() or so. Is there a way to get the Resolution subtree from json without building my own parser?

Thanks.

alexa-skill-kit sdk

can you provied a jar for alexa-skill-kit? I mean what is contain speechlet...

Get user input in the form of characters and also get email as input

Hi,

I'm creating a skill that takes in an email address and also, it should take an alpha numeric string with special characters, you ca think this as entering an email and password (But not exactly). Also this should have a clear distinguished from a Capital letter and a small letter.

for example the below is the flow

User : Alexa, open Store data bot.
Alexa : Hi Welcome to store data bot. please give me your email address to store.
User : [email protected]
Alexa : Give me a passphrase to store
User : Aa@12345!dc
Alexa : Details are stored. Thanks

And here the details are to be saved into my Session.

I tried giving it Abcdef123! (through voice), but unfortunately, this turned it out to be(by looking into the voice input in my Alexa app).

capital a. b. c. d. e. f. one. two. three. Exclamation mark.

Please let me know how can I do this.

Thanks,
Rakesh

Need 5 PRs merged into master

There are 5 open valid pull requests that need to be added. To save you some time, I've merged them in another repo for now and sent a PR to sync master up here. The last PR #18 has some bugs with null return types for SpeechletResponse on audio type requests that are not in other PRs here that are fixed as well. This also includes adding support for System.ExceptionEncountered json type so if the skill sends a reponse alexa doesn't like the skill will receive the error and can log it to investigate further.

This PR Supersede PR #18, #15, #13, #12 and #11.

Speechlet Interface (AudioPlayer / PlaybackController) Examples?

Not an issue, per se.

Just wondering if anyone has done anything with the AudioPlayer and / or PlaybackController interface that they'd be willing to contribute as sample code? I'm trying to get this working, but having a bit of trouble as I'm new to the SDK, so an example of working code for using the interfaces would be helpful...

Thanks,
phlepper

Images not showing up in cards

Images don't seem to be working for standard cards. I am assigning an image instance as below, but keep getting an 'No Image Found' message on the card. The images in question are hosted on S3 and available publically.

Image image = new Image();
image.setSmallImageUrl("https://s3.amazonaws.com/buckit/fireworks_small.png");
image.setLargeImageUrl("https://s3.amazonaws.com/buckit/fireworks_large.png");
StandardCard card = new StandardCard();
card.setTitle("Title");
card.setText(cardText);
card.setImage(image);

Issue while building maven project

I am new to maven, I gotta stuck while creating jar file. Please someone help me to resolve this issue.
Thanks in advance

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:16 min
[INFO] Finished at: 2017-01-27T11:41:31+05:30
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'assembly' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\Naveen.m2\repository), ibiblio.org (http://mirrors.ibiblio.org/pub/mirrors/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

Lambda Response error

The remote endpoint could not be called, or the response it returned was invalid.

This is the error I'm getting under Lambda response, when I tried to test HelloWorld use case. I followed the same steps mentioned in Read file. "ask greeter" was the utterance I gave and I simply tried with "Alexa, tell Greeter to say hello." too. And I got the same Lambda error response for both. How can I solve this issue ? Pasting the Lambda request below:

{
"session": {
"sessionId": "SessionId.50da034d-1004-459e-9547-802a1540ef5b",
"application": {
"applicationId": "amzn1.ask.skill.73e60cdb-96ce-45bc-a06f-0962f31139bb"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.AFZ7WC4XEPIBZNZTVMKPMRGEWDXDGZNYZVYU7HAT6WPITF6VFCI63ELIB5IOIA6RRTCRCQTOJAM5ZVBE5NCHRIO2IY2GM2WSS7FQPNNM2COSLFHWPBLLKWBU46GMJ5R2TRCBCXTYYBZKXXEAJ3L7NNZQ5KGJTJTBQRWEM3UJIJ7GSINGZSS44IKCA4GVZOHJZFZ3FCL5KYUYNRY"
},
"new": true
},
"request": {
"type": "LaunchRequest",
"requestId": "EdwRequestId.45b9a1d7-4adf-4812-8136-8d723b635297",
"locale": "en-US",
"timestamp": "2017-04-19T12:43:00Z"
},
"version": "1.0"
}

Saving ZonedDateTime in session attributes leads to misleading error message

The signature of Session.setAttributes(String, Object) suggests, that it is possible to save arbitrary data types. I assumed I could save Serializable classes like java.time.ZoneDateTime but that led to the following warning along with a spoken error message by Alexa:

WARN ResponseSizeSpeechletResponseVerifier:55 - Speechlet response with size of 53267 bytes exceeds the maximum allowed size of 24576 bytes and will be rejected by the Alexa service

To get around this, I fell back to saving a String using ZonedDateTime.toString() and using ZonedDateTime.parse(String) after retrieving it from the session's attributes.

It would be great if saving of Serializable Objects would be possible. If not, the documentation / java doc and error message should reflect that. Or am I getting something wrong here?

Will Not build as maven project

I love this code as it was a perfect way to get started on any alexa java skill.

when I try compiling it using cmd now using the command outlined in the documentation now, as opposed to two months ago, I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/logging/LoggerManager
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at org.codehaus.plexus.classworlds.launcher.Launcher.getEnhancedMainMethod(Launcher.java:172)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:268)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.logging.LoggerManager
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 10 more

Any ideas? Thank you!

Maven Central has alexa-skills-kit v1.3.0

Hi,

I noticed that maven central has the latest ASK for Java at version 1.3. However this github repo indicates via comments that it is at version 1.2. I noticed that there are no other branches or tags, so it must be a copy of some Amazon internal repo. When will this repo and its samples be upgraded to match your latest Maven release?

Thanks,
Baq

Cannot get audioplayer state to do things like pause playback

So using the 1.4.0 new version of the sdk, I can't seem to get audioplayer state if I make an intent called pausePlayback - I need the audio player state to find out where the current playback is in ms to store where they were at, so you can resume from that point.
There weren't any example but I was able to glean what should work like so:
private AudioPlayerState getAudioPlayerState(Context context) {
def playerState = context.getState(AudioPlayerInterface.class, AudioPlayerState.class)
log.debug("playerState=${playerState)}")
return playerState
}

So calling this from onIntent with the requestenvelope context. Is this the right way to get this state? I know this state is passed in because I have a working fork of the sdk where I read that information and I can access it. To get an audio skill certified you must support the pause and resume playback functions so a user would need this to work.

Class Not found exception

Hi,
i am working on to setup scorekeeper for alexa from the link
https://github.com/amzn/alexa-skills-kit-java/blob/master/samples/src/main/java/scorekeeper/README.md.

I have setup everything as mentioned in the link but while doing testing from Service Simulator, i am getting following error in lambda (CloudWatch)

Class not found: scorekeeper.ScoreKeeperSpeechletRequestStreamHandler: class java.lang.ClassNotFoundException
java.lang.ClassNotFoundException: scorekeeper.ScoreKeeperSpeechletRequestStreamHandler
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)

Can you please guide in getting this resolve. Thanks.

Echo Show 1.4 release

Hi,
Do you know when the 1.4 code will be released in Maven Central and corresponding sample apps will be updated to show usage of new Template etc..?

We are starting to optimize our skill which is under development for regular Echo to support Echo show and waiting for these new features.

Thanks

Provide clear steps

Hello. I wand to create new skill in Eclipse. But here i can only copy samples and test it. Can you please provide clear steps what i need do for to create lambda function for amazon skill from 0.

missing feature - selectable image for echo show

Hi According to doc, List Images suppose to be selectable.
I don't see this being implemented,

quote from doc:
A list template displays a scrollable list of items, each with associated text and optional images. These images can be made selectable, as described in this reference.

com.amazon.speech.speechlet.interfaces.display.template.ListTemplate2.ListItem doesn't have "selectable" property or something similar....
I know that for "primaryText" I can set a RichText with action:

	TextContent tc = new TextContent();
	RichText text = new RichText();
	text.setText("<font size=\"1\"><action value='recipe_details'>" + name + "</action></font>");
        tc.setPrimaryText(text);

Will the above work? (Alexa Skill Simulator for Show doesn't make the item selectable with the above code).

Can you please clarify how to make the ListItem clickable/selectable??

thanks

Update samples pom file to alexa-skills-kit 1.4.0

The pom.xml file in the samples directory points to the alexa-skills-kit version 1.3.0, but we really need 1.4.0 for the new classes for the echo show. Can you update the pom file to avoid build errors?

Very useful - should be published to maven

It would be great if this "SDK" was published to Maven.
At the moment I am simply copy-pasting it into my project but I think its good enough to warrant being a 1st tier library.

Signature validation failing if order of nodes are modified

Not sure if this is a issue. However wanted to raise it as I wasted time figuring it out the root cause.

I am using SpeechletRequestSignatureVerifier class to verify signature in my Dropwizard application.

  • Initially I tried to implement Signature validation as runtime annotation processor at Resource level. It failed because the InputStream is already consumed and not available in the HttpServletRequest.

  • Then I have Implemented a filter like the one below.

    @Override
    public void filter(ContainerRequestContext requestContext) throws IOException {
        String requestBody = IOUtils.toString(requestContext.getEntityStream());
        SpeechletRequestSignatureVerifier.checkRequestSignature(requestBody.getBytes(),
                requestContext.getHeaderString("Signature"),
                requestContext.getHeaderString("SignatureCertChainUrl");
        requestContext.setEntityStream(IOUtils.toInputStream(requestBody));
    }

Even then it didn't work. Because I was using Junit test case to test it and the Json nodes are jumbled somehow in my test case.
Not sure if there is a way to fix it because signature is based on the byte array.

Joda-Time timeout

Hey Guys, everytime i start your example i got a timeout at the following line.

All other package downloads are fine, only this one is failing.

artifact joda-time:joda-time: checking for updates from central
[WARNING] repository metadata for: 'artifact joda-time:joda-time' could not be retrieved from repository: central due to an error: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.112.215] failed: Connection timed out (Connection timed out)

i start the example with these 3 commands
mvn clean compile

mvn assembly:assembly -DdescriptorId=jar-with-dependencies package

mvn exec:java -Dexec.executable=”java” -DdisableRequestSignatureCheck=true

I'm using a docker inside CentOs7.
Same problem on windows .

I also tried to download joda-time in my pom.xml
and it worked

LaunchDirective is not launching video player

Hi all,
I am trying to add LaunchDirective to launch a video player, but the video is not launching and no error is returned.

Here is the setup:

  1. RenderTemplateDirective is rendered with TemplateBody3 which has some text "play video" with <action value="play_video">..</action> wrapped
  2. .onElement is fired and "play_video" token is passed
  3. i build the response as follows:
	public SpeechletResponse onElementSelected(SpeechletRequestEnvelope<ElementSelectedRequest> requestEnvelope) {
		log.info("UI element was selected: " + requestEnvelope.getRequest().getToken());
		
		String token = requestEnvelope.getRequest().getToken();
		if ("play_video".equals(token)) {
			SpeechletResponse response = new SpeechletResponse();
			List<Directive> directives = new ArrayList<>();
			response.setDirectives(directives);
			DirectiveHelper.addEchoShowVideoDirective(response);
			return response;
		}
  }

Code for: DirectiveHelper.addEchoShowVideoDirective(response)

	public static void addEchoShowVideoDirective(SpeechletResponse response) {
		VideoItem videoItem = new VideoItem();
		videoItem.setSource("https://s3.amazonaws.com/mybucket/video.mp4");
		Metadata metadata = new Metadata();
		metadata.setTitle("some title");
		metadata.setSubtitle("some subtitle!");
		videoItem.setMetadata(metadata);

		LaunchDirective launchDirective = new LaunchDirective();
		launchDirective.setVideoItem(videoItem);
		response.getDirectives().add(launchDirective);
	}

Echo Show is not playing the video..but there is no error, and i can't see the JSON response generated by the SDK anywhere..

Is this a bug or I am doing something wrong?

Lambda request Context is not preserved

com.amazon.speech.speechlet.lambda.SpeechletRequestStreamHandler.handleRequest(InputStream, OutputStream, Context) method receives Lambda Context as input, but the context is never passed to further processing.
Would be nice to include it in SpeechletRequestEnvelope.

Why it is so important?

  1. The context gives you access to remaining time for the lambda function. You can use the time to set timeouts for HTTP calls to your custom back-end.
  2. It gives you the AWS request ID that you can cross-reference with your CloudWatch logs.
  3. It gives you access to Logger

build error when run 'mvn assembly:assembly -DdescriptorId=jar-with-dependencies package'.

Hi, I try to run 'mvn assembly:assembly -DdescriptorId=jar-with-dependencies package' following your instruction. But I met some unexpected question. Why did it happen?
I really wanna know how to fix it

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project alexa-skills-kit-samples: Compilation failure: Compilation failure:
[ERROR] /home/local/ANT/longzhen/Downloads/alexa-skills-kit-java-master/samples/src/main/java/Launcher.java:[22,34] package org.eclipse.jetty.util.ssl does not exist
[ERROR] /home/local/ANT/longzhen/Downloads/alexa-skills-kit-java-master/samples/src/main/java/Launcher.java:[65,9] cannot find symbol
[ERROR] symbol: class SslContextFactory
[ERROR] location: class Launcher
[ERROR] /home/local/ANT/longzhen/Downloads/alexa-skills-kit-java-master/samples/src/main/java/Launcher.java:[65,67] cannot access org.eclipse.jetty.util.component.ContainerLifeCycle
[ERROR] class file for org.eclipse.jetty.util.component.ContainerLifeCycle not found
[ERROR] /home/local/ANT/longzhen/Downloads/alexa-skills-kit-java-master/samples/src/main/java/Launcher.java:[78,24] cannot access org.eclipse.jetty.util.component.LifeCycle
[ERROR] class file for org.eclipse.jetty.util.component.LifeCycle not found
[ERROR] /home/local/ANT/longzhen/Downloads/alexa-skills-kit-java-master/samples/src/main/java/Launcher.java:[82,15] cannot access org.eclipse.jetty.util.Attributes
[ERROR] class file for org.eclipse.jetty.util.Attributes not found
[ERROR] /home/local/ANT/longzhen/Downloads/alexa-skills-kit-java-master/samples/src/main/java/Launcher.java:[85,16] cannot access org.eclipse.jetty.util.component.Graceful
[ERROR] class file for org.eclipse.jetty.util.component.Graceful not found
[ERROR] /home/local/ANT/longzhen/Downloads/alexa-skills-kit-java-master/samples/src/main/java/Launcher.java:[86,15] cannot access org.eclipse.jetty.util.component.Destroyable
[ERROR] class file for org.eclipse.jetty.util.component.Destroyable not found
[ERROR] /home/local/ANT/longzhen/Downloads/alexa-skills-kit-java-master/samples/src/main/java/Launcher.java:[87,28] cannot access javax.servlet.http.HttpServlet
[ERROR] class file for javax.servlet.http.HttpServlet not found
[ERROR] /home/local/ANT/longzhen/Downloads/alexa-skills-kit-java-master/samples/src/main/java/Launcher.java:[87,16] cannot access org.eclipse.jetty.util.component.AbstractLifeCycle
[ERROR] class file for org.eclipse.jetty.util.component.AbstractLifeCycle not found
[ERROR] /home/local/ANT/longzhen/Downloads/alexa-skills-kit-java-master/samples/src/main/java/Launcher.java:[88,28] cannot access javax.servlet.Servlet
[ERROR] class file for javax.servlet.Servlet not found
[ERROR] /home/local/ANT/longzhen/Downloads/alexa-skills-kit-java-master/samples/src/main/java/Launcher.java:[89,15] method start in class org.eclipse.jetty.server.Server cannot be applied to given types;
[ERROR] required: org.eclipse.jetty.util.component.LifeCycle
[ERROR] found: no arguments
[ERROR] reason: actual and formal argument lists differ in length
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project alexa-skills-kit-samples: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:365)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:911)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)

Builders should include mandatory parameters in their constructor

The builders used in User, Session etc should be more verbose and include the mandatory parameters in the constructor.

For example, the Session cannot be built without the sessionId field being populated.
So, instead of a developer having to do:

Session.builder().withSessionId("session123").build();

why not have:

Session.builder("session123").build();

or:

Session.Builder.withSessionId("session123").build();

where withSessionId is the only public static method and returns a new Builder.

You could then rename the non-mandatory setters such as withAttributes to andAttributes to indicate which are mandatory and which are optional.

This would then look like:

Session.Builder.withSessionId("session123").andAttributes(new HashMap<String, Object)());

SpeechletRequestEnvelope.getContext() returning null

Hello,
SpeechletRequestEnvelope.getContext() returning null. Thus i can't detected supported interfaces to include RenderTemplate & Video DIrectives.

I've double checked that my skill's "Render Template" and "Video" interfaces are enabled in developer.amazon.com

When Testing from "Test" console...i get "NULL" context...

	@Override
	public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) {

...

	log.debug("====> requestEnvelop: " + requestEnvelope.getClass());
	log.debug("====> request: " + requestEnvelope.getRequest().getClass());
	log.debug("====> context: " + requestEnvelope.getContext());
	if (requestEnvelope.getContext() != null) {
		log.debug("====> context class: " + requestEnvelope.getContext().getClass());
	        log.debug("====> context has display: " + requestEnvelope.getContext().hasState(DisplayInterface.class));
		log.debug("====> context has video: " + requestEnvelope.getContext().hasState(VideoAppInterface.class));
					}

I've Skills RenderTemplate
LOGS:

18:43:26
====> requestEnvelop: class com.amazon.speech.json.SpeechletRequestEnvelope

18:43:26
====> request: class com.amazon.speech.speechlet.IntentRequest
18:43:26
====> context: null

Getting Slot Type Value ID

Hello,

Currently, I wasn't able to find a way to get the slot type value Id.
This would be useful, to map a group of words (Synonyms) to one java object attribute.
Is there any plan to add this feature in the future?

Greetings,
Michael

shouldEndSession cannot be null for VideoApp.Launch when used with ServletSpeechletRequestHandler

I'm trying to use VideoApp.Launch with ServletSpeechletRequestHandler
The call to handleSpeechletCall() always returns bytes containing shouldEndSession flag.
Even if I call setNullableShouldEndSession(null), the serialized output still contains the flag. I'm pretty sure that's because it is using the getter for serialization, and the getter always returns a value (see lines 67-69 in SpeechletResponse).

"error":{"type":"INVALID_RESPONSE","message":"shouldEndSession flag is not allowed with LaunchVideoApp.Launch Directive"}}}

ElementSelected in Echo Show

Can you show a C# working example of how to handle touch events in the echo show?

I understand that in the callback the token of the item selected is returned and I have to search for it in this.event.request.token
But i don't understand how that is implemented in C#

Excluding shouldEndSession parameter from SpeechletResponse

Hello,
I am working on 'Echo Show' skill using Java sdk. With '1.4.0' version, I was able to add 'Directives' to SpeechletResponse and most of the stuff is working fine.
But for video to work, the response should not contain 'shouldEndSession' parameter. As per link:
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/videoapp-interface-reference
It is mentioned as a note that: "The shouldEndSession parameter must not be included in the response, even if the value is set to null."

My response object always contains 'shouldEndSession = false'. Is there any way not to include 'shouldEndSession' in the response using java sdk?

mvn:assembly

I am trying to complete step 6 with little luck. How exactly do I run mvn:assembly to create the file to upload to the lambda function?

Update: build the pom.xml in netbeans after installing the maven plugin to netbeans, and this creates a folder containing 'alexa-skills-kit-1.0.java. Not sure if this helps but it is not a zip file, or have the same name as the one mentioned in step 6

I am using the netbeans IDE and so far I have created a new pom.xml file in my netbeans projects folder and built it.

Help appreciated

about the upload jar

i create a java lambda project and put the alexa-skill-kit jar into the project. Then i upload the poject into AWS Lambda website.but i can't find the SpeechletRequestStreamHandler.class, please help me

I download the alexa-skills-kit-java-master.zip and then I find a jar file in the root taget dir,I create a new java project and add this jar to the project,then i generate it to a jar and upload it to the aws,but when i test the funtion It prompts some error messages:


{
"errorMessage": "com.amazon.speech.speechlet.SpeechletRequestHandlerException: Could not validate SpeechletRequest null using verifier ApplicationIdSpeechletRequestEnvelopeVerifier, rejecting request",
"errorType": "java.lang.RuntimeException",
"stackTrace": [
"com.amazon.speech.speechlet.lambda.SpeechletRequestStreamHandler.handleRequest(SpeechletRequestStreamHandler.java:92)"
],
"cause": {
"errorMessage": "Could not validate SpeechletRequest null using verifier ApplicationIdSpeechletRequestEnvelopeVerifier, rejecting request",
"errorType": "com.amazon.speech.speechlet.SpeechletRequestHandlerException",
"stackTrace": [
"com.amazon.speech.speechlet.SpeechletRequestHandler.internalHandleSpeechletCall(SpeechletRequestHandler.java:145)",
"com.amazon.speech.speechlet.SpeechletRequestHandler.handleSpeechletCall(SpeechletRequestHandler.java:115)",
"com.amazon.speech.speechlet.lambda.SpeechletRequestStreamHandler.handleRequest(SpeechletRequestStreamHandler.java:89)"
]
}
}

please help me!

Dependency on com.amazonaws.services.lambda

If I download the source and add it to my (previously working with the Alexa Skills Kit 1.1 release) code, then I find that it depends on some Lambda classes. I'm not using Lambda and I can't see any documentation on how to get this code (maybe it is linked somewhere in your site but the location is really not obvious). E.g. in SpeechletRequestStreamHandler:

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;

hello i try to develope a alexa skill using this example but i get this error

org/slf4j/LoggerFactory: java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at mensathm.MensaThmSpeechlet.(MensaThmSpeechlet.java:25)
at mensathm.MensaThmSpeechletRequestStreamHandler.(MensaThmSpeechletRequestStreamHandler.java:28)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 6 more

Display.RenderTemplate and Other Directives in Response

I don't see the Echo Show directives in the package com.amazon.speech.ui.

Documentation is wrong as well.

In documentation: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/display-interface-reference

{ "primaryText": { "textField": { "text": "See my favorite car", "type": "PlainText" } }, "secondaryText": { "textField": { "text": "Custom-painted", "type": "PlainText" } }, "tertiaryText": { "textField": { "text": "By me!", "type": "PlainText" } } }

Correct which works on device:

{ "primaryText": { "text": "See my favorite car", "type": "PlainText" }, "secondaryText": { "text": "Custom-painted", "type": "PlainText" }, "tertiaryText": { "text": "By me!", "type": "PlainText" } }

Dependency on alexa-skills-kit:alexa-skills-kit:1.1

The Maven package com.amazon.alexa:alexa-skills-kit:1.1 declares a dependency on alexa-skills-kit:alexa-skills-kit:1.1. This package is not available on Maven Central. The only way I've been able to compile software with the ASK is to have a local checkout of this repo's repo directory, then point my pom.xml to this local directory as a local repository.

My software still compiles when I remove the dependency on alexa-skills-kit:alexa-skills-kit:1.1, so is that dependency even valid? If it is, can you add it to Maven Central?

Class not found error

I created a simple Hello world Alexa Skill as an AWS Lambda using Java based onhttps://github.com/amzn/alexa-skills-kit-java/tree/master/samples/src/main/java/helloworld.

But when I tried to test my lambda function it returned the following error

{

"errorMessage": "Error loading class helloworld.HelloWorldSpeechletRequestStreamHandler: com/amazon/speech/speechlet/lambda/SpeechletRequestStreamHandler",

"errorType": "class java.lang.NoClassDefFoundError"

}

what needs to be done?

@JsonInclude(Include.NON_DEFAULT) on getShouldEndSession() breaks sessions

The "default" for a boolean is false, regardless of the "initial" value set by the class. The effect of adding the @JsonInclude(Include.NON_DEFAULT) annotation means that anytime the setShouldEndSession(...) method is called with false, this property will be omitted from the JSON output. When deserialized, it will pickup the "initial" value of true... meaning with this annotation set, this property is effectively true after deserialization regardless of its original value.

One fix is to simply remove this annotation.

The error is on this line:
https://github.com/amzn/alexa-skills-kit-java/blob/master/src/com/amazon/speech/speechlet/SpeechletResponse.java#L57

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.