title: DialogFlow inline editor can't set response through if-statement
body: <p>I'm using DialogFlow for a project, and one part is to register users to a database, which works like it should but I'm checking if the UID already exist in the database, and if it does the user should be alerted, but this does not work. The <code>console.log()</code> message passes to firebase with the correct information, but it doesn't give any response to DialogFlow, in this case <code>message</code> will be the response.</p>
  
  <p>Here is my registerUser code:</p>
  
  <pre><code>  function registerUser(agent) {
  
      let added = false;
      let message = "Not used";
      ref.child(uid).once("value", function(snapshot) {
          if (snapshot.val() === null) {
              ref.child(uid).set({
                  FIRST_NAME: firstName,
                  LAST_NAME: lastName
              });
              added = true;
          }
      }).then(doc =&gt; {
          if (added === true) {
              message = "Great! You are now added to the database";
              console.log("User_added_success");
          }
          else {
              message = "User aldready exists!";
              console.log("User_added_fail");
          }
      });
      agent.add(message); 
    }
  </code></pre>
  
  <p>The output is <code>"Not used"</code> as response and the console.log() is <code>"user_added_success"</code></p>