Update dialog profile variables or post directly to chat interface?

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!

Upvotes: 0

Views: 108

Answers (1)

Dudi
Dudi

Reputation: 2430

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)

Upvotes: 1

Related Questions