0

I'm build an JS app that posts restaurant suggestions to users via a simple chat interface. I'm trying to reverse-engineer the movie assistant app, but I’m not sure how to write the part where the JS app posts data from DB to the UI. Unlike the movie assistant I would be using a simple text interface similar to the one the dialog-tool example features. I see two solutions:

  1. The JS app updates the dialog profile variables and the dialog then posts those to the UI. This means than I can also store additional variables, such as opening hours, etc and show those on user request. On the other hand I would have to blank out the profile variables every time the user searches for a place.
  2. This screenshot, shows a different approach where the JS app posts results directly in the UI. The app would only posts when the variable search_now = yes. I think this is similar to the movie app.

Which of the two solutions is ideal? Thanks!

  • Welcome to StackOverflow. Pasting your code into your question is much more useful than just including a screenshot. Further, I'd suggest changing your tags to be more relevant to the language and question you're asking. – sschale Mar 12 '16 at 05:34

1 Answers1

1

The recommended method is for you application to post the variables to Dialog. Indeed those variables might change on subsequent searches from the user. However this allows you to have in your dialog conditions based on the values.

See here an example to a code to post variables Dialog application starter kit - app.js

log('6. updating the dialog profile with the result from themoviedb.com');
          var profile = {
            client_id: req.body.client_id,
            name_values: [
              { name:'Current_Index', value: searchResult.curent_index },
              { name:'Total_Pages', value: searchResult.total_pages },
              { name:'Num_Movies', value: searchResult.total_movies }
            ]
          };
          return updateProfile(profile)
Dudi
  • 2,340
  • 1
  • 24
  • 39