1

It seems that currently it is not possible to add two directives within the Responsebuilder.

The Scenario:

My Skill has an optional Slot "UserSelection" of the Type Picklist.

The Intent itself searches for objects and if there are more than one, it creates the UpdateDynamicEntities Directive for UserSelection. In that case I want to update the Picklist dynamically and let the user choose one of them.

Therefore my code looks like this:

  // TO MANY RECORDS. LET USER CHOOSE ONE
  var List = ''
  selection = true;
  replaceEntityDirective = {};
  replaceEntityDirective.type = 'Dialog.UpdateDynamicEntities';
  replaceEntityDirective.updateBehavior = 'REPLACE';
  replaceEntityDirective.types = [];
  var values = [];
  var propertyValues = [];
  var name = 'UserSelection';
  query.records.forEach(element => {
    var item = element._fields;
    var id = item.id;
    var value = item.name;
    var synonyms = [];
    var name = { value, synonyms };
    values.push({ id, name });
    List = List + item.name + ', <break time="0.5s"/>';
  });
  speechOutput = requestAttributes.t('SELECTION', List);
  reprompt = speechOutput;

return handlerInput.responseBuilder .speak(speechOutput) .addDirective(replaceEntityDirective) .addElicitSlotDirective('UserSelection') .reprompt(reprompt) .getResponse(); This results into the Exception

    "error": {
        "type": "INVALID_RESPONSE", 
        "message": "No other directives are allowed to be specified with a Dialog directive. The following Directives were returned: [Dialog.UpdateDynamicEntities]" 
   } 

I could not find any limitation in the documentation, so im curios about the exception. if it is a current limitation, any idea on how to solve my problem?

Why am I using a Picklist instead of AMAZON.SearchQuery. I assume a Picklist is more accurate in recognition than SearchQuery. Would make sense. Of course I could use AMAZON.SearchQuery which is less accurate and i have to care about it in the code.

Any Ideas?

Your Answer

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

Browse other questions tagged or ask your own question.