4

I want to send queryParameters , mostly the payload on dialogflow so i can get it on google cloud function.

I've tried

private function getPayload(ChatbotDialog $dialog): Struct
    {
        $data = '{
                  "fields" : {
                    "source" : {
                        "stringValue" : "platform",
                        "kind" : "stringValue"
                    }
                  }
        }';
        $payload = new Struct();
        $payload->mergeFromJsonString($data);
        return $payload;
    }

$queryParam = new QueryParameters();       
$queryParam->setPayload($this->getPayload($dialog));

but it seem it does not work the originalDetectIntentRequest is always empty on cloud function.

I've seen that : Send parameters to webhook on dialogflow sdk v2

but they use queryInput.event and i use queryInput.text so the solution does not work.

jdp
  • 3,446
  • 2
  • 30
  • 54
fvhde.exe
  • 115
  • 7
  • 4
    I found the solution , i was setting `$optionalsParams = ['queryParameters' => $queryParam];` instead of `$optionalsParams = ['queryParams' => $queryParam];` Before : `$response = $sessionsClient->detectIntent($session, $queryInput, $optionalsParams);` – fvhde.exe Aug 02 '19 at 08:32
  • 2
    You saved my day! I mentioned your post in my question because I struggled to find it. Hope others will find it more easily now : https://stackoverflow.com/questions/58557233/dialogflow-v2-api-how-to-pass-context-and-or-payload-php – Christopher Smit Oct 25 '19 at 11:11

0 Answers0