Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Properly Injected SSML
* Creates a {@code SpeechletResponse} for the hello intent.
* @return SpeechletResponse spoken and visual response for the given intent
private SpeechletResponse getHelloResponse(Session session) {
String speechText = "Hello world";
// Create the Simple card content.
SimpleCard card = new SimpleCard();
SsmlOutputSpeech speech = monetize.injectSSML(session.getUser().getUserId(),
"<speak>Hello! And now a word from our sponsor {ad} What would you like to do?</speak>",
"<speak>Hello! Tell me something!</speak>")
return SpeechletResponse.newTellResponse(speech, card);
public void onSessionStarted(final SessionStartedRequest request, final Session session)
throws SpeechletException {"onSessionStarted requestId={}, sessionId={}", request.getRequestId(),
// any initialization logic goes here
"version": "1.0",
"response": {
"outputSpeech": {
"type": "SSML",
"ssml": "<speak>Hello! And now a word from our sponsor <audio src=\"\" /><audio src=\"\" /> What would you like to do?</speak>"
"card": {
"type": "Simple",
"title": "HelloWorld",
"content": "Hello world"
"shouldEndSession": true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment