Federico Plazzotta avatar image
Federico Plazzotta asked

APL Card: ExecuteCommandsDirective(SpeakItem) not spoken on Echo Show while working on dev console


I have developed an APL card with a Pager, I am now trying to figure out a way to make such card scrollable without Alexa stopping its speech when the user interacts with the APL card.

Consequently I have tried adding 2 directives to the response_builder:

1. RenderDocumentDirective with the datasource about the APL card to be rendered

2. ExecuteCommandsDirective, with the details about the speakItem command I want to be pronounced while Alexa is displaying the APL card, and which I do not want to be interrupted by user's touch on the card.

My issue is the following: the SpeakItem command seems to be not executed on Echo Show, while it correctly works on Developer Console. In particular, on Echo Show the APL card is rendered correctly but nothing is pronounced. The blue bar reporting that Alexa microphone is ready for user's response is showed immediately after the card is displayed, as if Alexa had already finished talking.

I attach here a simplified version of my python code


a simplified version of the APL card template and relative dataSource


I would also like to add that I could successfully send other commands with the ExecuteCommandsDirective, such as Idle, but I could not make it work for SpeakItem and SpeakList on Echo Show.

Thank you for your help.

echo showapl
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Andy Whitworth avatar image
Andy Whitworth answered

I created some notes when I was playing around with sequencers:

A sequencer works when associated with a SpeakItem command invoked with an ExecuteCommands directive but only if withShouldEndSession is set to undefined. This has the effect of not opening the microphone so no good for cases where user voice interaction is required.
Setting withShouldEndSession to false opens the microphone but the SpeakItem command does not work when a sequencer is associated with it.

That seems to describe your situation.

So your SpeakItem shouldwork if you set shouldEndSession to undefined (or just omit it from your response_builder command). But the microphone won't open so the user would need to use the wake word to interact with the skill via voice.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Federico Plazzotta avatar image Federico Plazzotta commented ·
Hi @Andy Whitworth, thank you for your reply and for confirming the issue.

Did you find any way around this problem to achieve the opening of the microphone after the SpeakItem command?

Do you have any idea why it is working on dev console but not on Echo Show?

0 Likes 0 ·
Andy Whitworth avatar image Andy Whitworth Federico Plazzotta commented ·

The only solution I found was to issue a SendEvent APL command after the SpeakItem had completed. The Alexa.Presentation.APL.UserEvent handler in my lambda could then issue a response with a reprompt and shouldEndSession set to false, this opens up the microphone.

1 Like 1 ·
Federico Plazzotta avatar image Federico Plazzotta Andy Whitworth commented ·

Hi @Andy Whitworth, thank you for your reply.

By following your suggestion I could correctly send shouldEndSession set to false as response to a UserEvent, hence I could successfully open the microphone. However, the UserEvent is sent as soon as the previous command (speakItem) is executed, so the microphone is opened while Alexa is still pronouncing the content of the speakItem command. I would like to find a way to "idle" for the exact amount of time that Alexa needs to pronounce the sentence before sending the userEvent and hence open the microphone.

Here are the commands I am sending through ExecuteCommandsDirective

commands = [
{"type":"Sequential", "commands": [
{"type":"SpeakItem", "componentId":"mainSpeech", "sequencer":"intro"},
{"type":"SendEvent", "arguments":[{"open_mic":True}] }
0 Likes 0 ·
Show more comments