How do I save and retrieve information across invocations of my agent in Dialogflow?

后端 未结 5 1664
执笔经年
执笔经年 2020-12-03 05:54

I would like my Actions on Google agent to store and retrieve certain pieces of information across invocations - like a cookie. How do I do this?

5条回答
  •  情话喂你
    2020-12-03 06:38

    You can save the information in Context with a key value parameter.

    SAVING VALUES IN CONTEXT :

    agent.set.Context({
      name:'context-name',
      lifespan: 5,
      parameters:{
        'parameter-name':'parameter-value'
        }
    });
    

    GETTING VALUES FROM CONTEXT

     agent.getContext('context-name');
    

    For more Details : https://dialogflow.com/docs/contexts/contexts-fulfillment

提交回复
热议问题