# Presentation - Alexa Building Blocks

These blocks allow you to generate a response to the user during runtime.

# ax.ask()

This block allows you to ask question to the user.

ax.ask("what is your name?").build();

// or
ax.ask("what is your name?")
  .reprompt("your name please")
  .build();

// or with SSML
ax.ask(
  ax
    .ssml("what is your name?")
    .effect(ssml.Effect.Whispered)
    .build()
)
  .reprompt("your name please")
  .build();

For SSML documentation, check SSML.

# ax.say()

This block allows you to say something back to the user and then close the session.

ax.say("Hello!");

// or with SSML
ax.say(
  ax
    .ssml("Hello!")
    .effect(ssml.Effect.Whispered)
    .build()
);

For SSML documentation, check SSML.

Tip

Notice that there is no .build() at the end of this block. Some simple blocks don't have .build().

# ax.directive()

This block allows you to return a raw directive back.

ax.directive({
  /** directive object */
});

# ax.end()

Similar to ax.start(), this block handles the SessionEndedRequest gracefully. Hence, it is important to add this block in your skill's terminal states.

# ax.empty()

Sometimes, you may not want to render any response back. This is useful when you want to handle the SessionEndedRequest using your own code. You can return this block after implementing your custom code.

# ax.ssml()

You can use ax.ssml() building block to build SSML (Speech Synthesis Markup Language) output speech. Learn about SSML primitives here(opens new window) .

# .voice()

ax.ssml("hello")
  .voice(ssml.Voice.Brian)
  .build();

# .domain()

ax.ssml("Latest news: The conversational and news styles are now available!")
  .domain(ssml.Domain.news)
  .build();

# .effect()

ax.ssml("I am not a real human.")
  .effect(ssml.Effect.whispered)
  .build();

# .emotion()

ax.ssml("Christina wins this round!")
  .emotion(ssml.Emotion.excited, ssml.Intensity.medium)
  .build();

# .appendAudio()

ax.ssml("Welcome to Ride Hailer")
  .appendAudio("soundbank://soundlibrary/transportation/amzn_sfx_car_accelerate_01")
  .build();

# .appendBreak()

ax.ssml("There is a three second pause here")
  .appendBreak(3000) // 3 seconds break
  .append(ax.ssml("then the speech continues.").build())
  .build();

# .emphasis()

ax.ssml("I already told you I ")
  .append(
    ax
      .ssml("really like")
      .emphasis(ssml.EmphasisLevel.strong)
      .build()
  )
  .append(ax.ssml("that person.").build())
  .build();

# .lang()

ax.ssml("Paris")
  .lang(Locale.fr_FR)
  .build();

# .paragraph()

ax.ssml("This is a paragraph")
  .paragraph()
  .build();

# .phoneme()

ax.ssml("pecan")
  .phoneme(ssml.PhoneticAlphabet.ipa, "pɪˈkɑːn")
  .build();

# .volume()

ax.ssml("Hello!")
  .volume(ssml.Volume.loud)
  .build();

# .pitch()

ax.ssml("Hello!")
  .pitch(ssml.Pitch.medium)
  .build();

# .rate()

ax.ssml("Hello")
  .rate(ssml.Rate.medium)
  .build();

# .sentence()

ax.ssml("Hello")
  .sentence()
  .build();

# .sayAs()

ax.ssml("12345")
  .sayAs(ssml.Interpreters.digits)
  .build();

# .sub()

ax.ssml("al")
  .sub("aluminum")
  .build();

# .wordRole()

ax.ssml("read")
  .wordRole(ssml.WordRole.vbd)
  .build();