Mike
Mike

Reputation: 1331

How to set outputContext from inline editor in dialogflow v2 api

I'm setting the responses via the inline editor eg:

function send_response(agent)
{

    agent.add("This is a response");

}

I would also like to set the outputContext via the inline editor as per the V2 api https://dialogflow.com/docs/fulfillment

"outputContexts": [
    {
      "name": "projects/${PROJECT_ID}/agent/sessions/${SESSION_ID}/contexts/context name",
      "lifespanCount": 5,
      "parameters": {
        "param": "param value"
      }
    }
  ]

Wouldn't mind some advice on how to do it.

Thanks

Upvotes: 1

Views: 2512

Answers (1)

dedman
dedman

Reputation: 908

You can use agent.setContext() for this, see this dialogflow sample for reference,

agent.setContext({
  "name": 'context-name',
  "lifespan": 1,
  "parameters":{"param": "param value"}
});

Upvotes: 5

Related Questions