assistant-simple icon indicating copy to clipboard operation
assistant-simple copied to clipboard

How can I add a context variable in api.js?

Open Austin-Jones opened this issue 5 years ago • 0 comments

I can add a context variable by editing the payload in app.js, but I would like to update a context variable when a user submits a message. I tried changing the payload in api.js to look like this:

var payloadToWatson = {
  session_id: sessionId,
  input = {
    message_type: 'text',
    text: text,
    options: {
      return_context: true
    }
   },
   context : {
    skills: {
      "main skill" : {
        user_defined: {
          location : myVar
        }
      }
    }
  }
 };

There is an updateMessage function according to the Watson API but the api.js component does not use this. Any ideas on how I can update the context variable? Thanks in advance.

Austin-Jones avatar Nov 18 '20 05:11 Austin-Jones