Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick replies are set in the wrong directive on Alexa #1466

Closed
1 of 4 tasks
acerbisgianluca opened this issue Nov 18, 2022 · 0 comments · Fixed by #1467
Closed
1 of 4 tasks

Quick replies are set in the wrong directive on Alexa #1466

acerbisgianluca opened this issue Nov 18, 2022 · 0 comments · Fixed by #1467

Comments

@acerbisgianluca
Copy link
Contributor

I'm submitting a...

  • Bug report
  • Feature request
  • Documentation issue or request
  • Other... Please describe:

Expected Behavior

On Alexa, output.quickReplies are attached to the first directive of the directives array, but sometimes the first directive is the UpdateDynamicEntities directive if output.listen contains dynamic entities.

Jovo should filter directives array to find only Alexa.Presentation.APL.RenderDocument directive.

Current Behavior

If both output.quickReplies and output.listen are set, datasources object is added into the dynamic entities directive because it's the first directive to be pushed into directives array.

const quickReplies = output.quickReplies;
if (quickReplies && this.config.genericOutputToApl) {
const directive: AplRenderDocumentDirective | undefined = response.response
.directives?.[0] as AplRenderDocumentDirective | undefined;
if (directive) {
if (!directive.datasources?.data) {
directive.datasources = {
data: {},
};
}
directive.datasources.data.quickReplies = quickReplies.map(
(quickReply: QuickReplyValue) => {
if (typeof quickReply === 'string') {
return { type: 'QuickReply', intent: quickReply };
} else {
return { type: 'QuickReply', ...quickReply };
}
},
);
}
}

The result is:

{
  datasources: {
    data: {
      ...
    }
  },
  type: "Dialog.UpdateDynamicEntities",
  types: [...],
  updateBehavior: "REPLACE"
}

Your Environment

  • Jovo Framework version used: 4.4.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants