Request Acts in the Alexa Conversations Core Library


In the Alexa Conversations Description Language (ACDL), you associate events with request acts. Request acts convey to Alexa Conversations some additional information about an event. For example, request acts convey whether the event represents the initiation of a conversational flow, an affirmation to a previously returned question, a denial, and so on.

Syntax

You associate a request act with the representation of an event by using the expect() action in the following format.

action T expect<T>(Type<RequestAct> act, Event<T> event)

The expect() action, which is from the Alexa Conversations Core Library (ACCL), accepts a RequestAct argument. The RequestAct argument can be one of the following values: Affirm, Deny, Inform, Invoke. For details about each request act, see Supported request acts.

The expect() action also accepts an event. The event declaration, which is also in ACDL, specifies an utterance set that contains speech that the user might say to trigger the event. In this way, you tie together user utterances with the goal (request act) of the user.

Supported request acts

Alexa Conversations supports the following request acts:

You can't define your own request acts. Alexa Conversations rejects custom request acts that extend RequestAct.

Affirm

Conveys that Alexa Conversations should treat the event as an affirmation. This request act usually follows a skill-initiated question. For example, the expected event represents a response such as, "Yes."

Example:

dialog Weather {
  sample {
    ...
    confirmationResponse = expect(Affirm, ConfirmGetWeatherEvent)
    ...
  }
}

Deny

Conveys that Alexa Conversations should treat the event as a denial. This request act usually follows a skill-initiated question. For example, the expected event represents a response such as, "No."

Example:

dialog Weather {
  sample {
    ...
    denialResponse = expect(Deny, DenyGetWeatherEvent)
    ...
  }
}

Inform

Conveys that Alexa Conversations should treat the event as information. This request act usually follows a skill-initiated question. For example, the expected event represents a user answer such as, "the second one," "to London," or "tomorrow."

Example:

dialog Weather {
  sample {
    ...
    cityResponse = expect(Inform, InformCityEvent)
    ...
    getWeather(cityResponse.city)
  }
}

Invoke

Conveys that Alexa Conversations should treat the event as a user-initiated request to start the conversation flow. For example, the expected event represents the user's request, such as, "I would like the weather in Seattle," "Get me a ride to Seattle," and "How is the weather in Seattle today?"

Example:

sample {
  findMovies = expect(Invoke, FindMoviesEvent)
}

Cross reference between request acts and dialog acts

If you develop Alexa Conversations skills by using the developer console, you're familiar with the concept of user input dialog acts. User input dialog acts help Alexa Conversations identify the purpose of user utterances within the flow of a dialog. With the ACCL, you specify user input dialog acts by using request acts.

The following table shows the request act that corresponds to each user input dialog act.

Dialog act Request act Description

Affirm

Affirm

The user is affirming the request that Alexa asked the user to confirm in the previous turn.

Example: "Yes."

Deny

Deny

The user is denying the request that Alexa asked the user to confirm in the previous turn.

Example: "No."

Inform Args

Inform

The user is providing API arguments that Alexa requested in the previous turn.

Example: "Seattle."

Invoke APIs

Invoke

The user is on a dialog path to invoking one or more APIs.

Example: "What's the weather in Seattle?"


Was this page helpful?

Last updated: Nov 27, 2023