Skip to content

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

@Austin-Jones

Description

@Austin-Jones

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions