I don\'t understand how you\'re supposed to save data. I tried using
let conv = agent.conv()
conv.data.data1=mydata //to save
mydata = conv.data.data1 //to
Also if you want to mark those parameters as required and use slot filling, that will automatically generate your output contexts during fulfillment. You can see this through a basic sample here: https://github.com/dialogflow/fulfillment-slot-filling-nodejs
Use the output context to save parameters
{
"fulfillmentText":"This is a text response",
"fulfillmentMessages":[ ],
"source":"example.com",
"payload":{
"google":{ },
"facebook":{ },
"slack":{ }
},
"outputContexts":[
{
"name":"<Context Name>",
"lifespanCount":5,
"parameters":{
"<param name>":"<param value>"
}
}
],
"followupEventInput":{ }
}
If you are using NodeJS client
You can save context with parameters like
let param1 = [];
let param2 = {};
let ctx = {'name': '<context name>', 'lifespan': 5, 'parameters': {'param1':param1, 'param2': param2}};
agent.setContext(ctx);
and get it like
let params = agent.getContext("<context name>").parameters;
let param1 = params.param1;
let param2 = params.param2;
You can store arrays, JSON obj but there is a limit to the total payload the response can save. check for more details here. For large data, use DB.
Also, if you are using standalone actions-on-google, then you can simply add key-value pair to the data object. See the link where they are storing a count