$update_response = file_get_contents("php://input");
$update = json_decode($update_response, true);
$reply = 'Message';
$context = array();
$context[0]['lifespanCount'] = 1;
$context[0]['name'] = $update['session'].'/contexts/newUser';
echo json_encode((array(
'fulfillmentText' => $reply,
'outputContexts' => $context,
'source' => 'Agent')));
I'm using the code shown above in my php webhook to set the context of my conversation after an initial.
This is what my fullfillment response looks like once parsed in Dialogflow console
{
"fulfillmentText": "Message",
"outputContexts": [
{
"lifespanCount": 1,
"name": "projects/agent-duvwmd/agent/sessions/8b044ab6-cc42-f663-18a3-409e2983c3f1/contexts/newUser"
}
],
"source": "Agent"
}
My agent is succesfully sending a reply and I can see that the name of the context newUser is shown properly on the dialogflow console, however it wont be accepted as context input for my only other intent.
It wont direct the conversation to my other intent even though I have set its input context as newUser and the parameter entity is set to sys.any so it should basically accepting any input. I only have two intents, and no more contexts so my context is not working at all. I set the lifespancount to 1, somethings 5, yet it doesn't seem to be working at all.
This is such a small project that using the Google Dialogflow Library would be more of a hinderance so I will not use it.
What is causing this problem?
EDIT: This is what the Raw API Response looks like in the next intent (after newUser context is set)
{
"responseId": "e6a89789-bc1d-4f15-94e4-86404060c4b9-83ffff32",
"queryResult": {
"queryText": "Something",
"parameters": {},
"languageCode": "es"
}
}
There is no context or anything. Here is what my contexts look like in intent2
I have webhook disabled on the second intent

