1

I have only 1 intent, which must ask for a pin code. If the pin code is not right, then ask it again, maximum 3 times.

What's the right way to implement it? (I use alexa-sdk with nodejs)

I tried to implement two approaches, but they failed with EXCEEDED_MAX_REPROMPTS:

if pin_is_correct
  emit(:tell, "cool")
else
  emit(:ask, "what is your pin?", "what is your pin?")

and

unless pin_is_correct
  let updatedIntent = this.event.request.intent
  delete updatedIntent.slots.MY_PIN_SLOT_NAME.value
  this.emit(':delegate', updatedIntent)

if this.event.request.dialogState !== 'COMPLETED'
  this.emit(':delegate')

emit(:tell, "cool")

any example solving this same problem?

1 Answer 1

1

You set your counter and keep it incremental for every wrong entry. When reach max retries you can call custom method (you need to make few changes in your sdk) e.g

stopAlexa: function (speechOutput) {
        this._context.succeed(buildSpeechletResponse({
            session: this._session,
            output: speechOutput,
            shouldEndSession: true
        }));
    }

Here shouldEndSession: true is play the role to stop the Alexa programatically.

1
  • Thanks! however my solution was avoid to use Dialog. Something like: if (!slot or pinIsIncorrect()) { this.emit(':ask', 'pin again?'); }. You don't need to change the SDK. Oct 15, 2017 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.