iboldurev / dialogflow

Unofficial php sdk for Dialogflow
https://dialogflow.com/
MIT License
164 stars 60 forks source link

Does this API work with DialogFlow V2 and the Oauth2-based authentication method? #20

Open nimrod-cohen opened 6 years ago

nimrod-cohen commented 6 years ago

if not, do you have any intentions of upgrading?

thanks in advance,

gambry commented 6 years ago

By having a look at https://dialogflow.com/docs/reference/v1-v2-migration-guide-fulfillment , definitelly V2 is not supported. Also this is only a library, no implementations - i.e. authentication type - are covered. You need to write them yourself.

I believe we need to put some effort all together and upgrade this library to support Dialogflow API v2.

gambry commented 6 years ago

I've started some work in order to support API V2 in here: https://github.com/gambry/dialogflow/tree/v2.x Contribution are welcome and I'm more than happy to converge the effort (and the code) in here so this remain the main repository.

I personally need just to get working Request and Response webhook models, so I probably won't be able to cover immediately anything not required by these two classes.

I've started by setting up the test framework and a basic test again current code and Dialogflow V1. The current codebase can benefit from this too. When happy with the test coverage I'll migrate the test and code to V2.

gambry commented 6 years ago

I've migrated the Request model (and dependencies) to V2, I will soon move to the Response and then finally clean up any other bits still in V1. Contributions are always appreciated as well as @iboldurev merging the work in a branch in this repo.

gambry commented 6 years ago

I completed the first draft of V1 to V2 Api migration for webhook fulfillment. I was moving to the client bit and then I noticed https://github.com/GoogleCloudPlatform/google-cloud-php-dialogflow , which is the official Detect Intent and Agent APIs PHP sdk. I believe that one makes iboldurev/dialogflow library obsolete?

The webhook request/response handling is not supported on that library, so in my fork I'm going to delete anything other than the webhook bit and publish it.

I'm still happy to join the forces and doing contribution in a single repo.

In the meanwhile I believe this issue can be closed.

ctrlaltdylan commented 6 years ago

@gambry do you know if v2 only supports parameter parsing via a webhook?

In v1 we could parse the detected parameters via the API response. I tried using the official v2 PHP SDK by Google, but the PHP Protobuf doesn't seem to be able to parse Parameter data into strings. This is pretty frustrating.

gambry commented 6 years ago

do you know if v2 only supports parameter parsing via a webhook?

@ctrlaltdylan I assume parameters are sent either using webhook or the API, and so I also assume they are handled correctly with the v2 PHP SDK provided by google.

PHP Protobuf doesn't seem to be able to parse Parameter data into strings

I never used Protobuf structure, so I can't help. I'm assuming it has its own setter and getter, you have just to figure out how to call then. Have you tried with magic methods i.e. $parameters[0]->myParameterName or with a getter like $parameters[0]->getMyParameterName()? I believe only xdebug can help you. :(

This is pretty frustrating.

TBH the migration for the only webhook bit was really difficult and messy. I don't think I'll use the V2 anytime soon, as apparently the only benefit is handling audio and streams rather than only text.

ctrlaltdylan commented 6 years ago

@gambry I totally agree.

Webhooks just make QA harder, and I don't see much benefit besides Google naturally making you handle storage of parameters in an async way.

I've even opened an issue on the PHP Protobuf client repo, but my issue is one of > 400. I'm putting a lot of faith in Google to not deprecate V1 before they sort out the PHP Protobuf issues and Dialogflow V2 client issues.

I have not tried magic methods! Maybe that's what I was missing. Either way, they don't document that at all.