title: How to get context variables from the response of IBM watson assistant V2 using Nodejs?
body: <p>We are using IBM watson assistant for NLU and backend we are using Nodejs for API calling. I am able to connect and get JSON response from watson assistant. For that I used following package 'watson-developer-cloud/assistant/v2'.</p>
  
  <p>I am handling context/slots within watson so I just want to get the values of those context variables/slots in the JSON response.</p>
  
  <p>I tried to send the context variables in text response (JSON file) from watson.</p>
  
  <p>Also tried to get context with watson assistant V1 but there the problem is session handling so I preferred to go with watson assistant V2</p>
  
  <pre><code>const AssistantV2 = require('watson-developer-cloud/assistant/v2');
  const assistant = new AssistantV2({
    version: 'XXXX-XX-XX',
    iam_apikey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    url: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
  });
  
  var sess_id;
  
  assistant.createSession({
      assistant_id: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
  })
    .then(res =&gt; {
      sess_id=res.session_id;
  })
    .catch(err =&gt; {
      console.log(err);
  });
  
  assistant.message({
      assistant_id: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
      session_id: sess_id,
      input: {
          'message_type': 'text',
          'text': 'Message'},
      })
      .then(res =&gt; {
          console.log(JSON.stringify(res, null, 2))
          console.log(res)})
  </code></pre>
  
  <p>Expected: 
  I should get context in watson Json response </p>
  
  <p>Actual:
  I am not getting context in watson Json response</p>