Dynamic entities/input types


#1

Hi,

Is there a way to dynamically load entities from an API for example? I am building an app that can apply filters to a search but those filters change sometimes, so it would be ideal to reload the entities with each call or every once in a while with a build for example.

Any suggestions?
Thanks :slight_smile:


#2

Hi @Donna :wave:

For Alexa Skills, you can use the new dynamic entities feature: https://developer.amazon.com/docs/custom-skills/use-dynamic-entities-for-customized-interactions.html

It would look similar to the example in the Amazon docs:

let replaceEntityDirective = {
      type: 'Dialog.UpdateDynamicEntities',
      updateBehavior: 'REPLACE',
      types: [
        {
          name: 'AirportSlotType',
          values: [
            {
              id: 'SJC',
              name: {
                value: 'San Jose International Airport',
                synonyms: ['San Jose', 'SJC']
              }
            },
            {
              id: 'JFK',
              name: {
                value: 'John F. Kennedy International Airport',
                synonyms: ['New York', 'LGA']
              }
            },
            {
              id: 'BOS',
              name: {
                value: 'Logan International Airport',
                synonyms: ['beantown', 'bean town', 'the hub', 'logan']
              }
            }
          ]
        }
      ]
    };

this.$alexaSkill.addDirective(replaceEntityDirective);

#3

Hi,

Thanks for the reply! We are mainly focussing on a bot for the Google Assistant, but thanks for this link, it will probably be very useful when we elaborate functionalities to Alexa.

For now, i wrote a script to update the json file in models. This script gets the necessary information from the API and parses it into the existing JSON. Is is possible to run this automatically every time i run jovo build? Now Iā€™m running it manually with node UpdateFilters.js

Thanks :smiley: