-
Notifications
You must be signed in to change notification settings - Fork 819
Dialogflow middleware using api v2 #1010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.0
Are you sure you want to change the base?
Conversation
composer require google/cloud-dialogflow environment variables to add to your .env file: GOOGLE_CLOUD_PROJECT=project-id GOOGLE_APPLICATION_CREDENTIALS=/path/to/project-secret.json get your application credentials file from the google cloud console (Service account) Drop-in replacement for the v1 Middleware
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.0 #1010 +/- ##
======================================
Coverage ? 80.61%
Complexity ? 632
======================================
Files ? 52
Lines ? 1718
Branches ? 0
======================================
Hits ? 1385
Misses ? 333
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
only one month remaining before v1 shutdown |
Hi, @eclips16 I'm trying to use your middleware but I can't, can you help me giving an small example of how you are using it? I'm getting an error when I try to use like this:
|
@atsoares what error are you getting ?
pay attention to the code you pasted: |
Hi @eclips16, thanks for that, now there's no error but I didn't figure out how to get the dialogflow response as botman reply. My problem is, I have a beautiful agent in Dialogflow that works perfectly already with his own fulfillment inline editor. I'm trying to use BotMan just to use the botman widget as widget in a website, receiving the message typed from the user, passing it to dialogflow and getting back all the response from that, including the rich responses. I tried to use botcopy or kommunicate but they are expensive for my case. |
I am afraid I won't be able to help you with so little information on the code. |
Oh man, I will try it with V1. Thanks! |
@eclips16 mate, thanks for the help but it still doesn't work. I kept the v1 version and my code is:
When I use a basic command like hears('hello'), the bot replies, but not when I use middleware. |
Sure man I did it, the agent is already done and as I said the History logs at Dialogflow's console shows all the text that I sent when I was testing the botman widget. |
console.log('works');
to see the intent and action returned by dialogflow |
Thanks mate, I don't know why but after that I used the error_log and checked at error.log, the bot started to reply. Really, I just checked the error log and everything was there, the bot just didn't want to reply I'm guessing. edit: actually maybe the whole problem was that
|
did you try to use my dialogflow v2 middleware now that it is working for you with v1 ? :) |
Hi @eclips16, Special thank you, for making this middleware. It run almost flawless. However today I encounter this problem
In your case the error stuck in line 132 unsure what happen. Maybe you can help. |
@ranrinc can you please tell me how to reproduce this issue ? |
try this code and make sure you install google API library and add its need information into your .env
|
Okey I already have this code in place but I do not have the error. |
Here is the raw json from 2 intents... it work on dialogflow console btw..
in conjuction to this intent
Again thank you for all the help |
I am sorry @ranrinc but I am enable to load the intents in my dialogflow console |
Actually it doesn't because I don't use Laravel, its an old pure php website that I'm working with. |
Since my dialogflow consist 3rd party API is possible for me to share the DF so you can seeing it? instead of recreating? because I believe if I give you the save DF.. it wont work without the backend connection |
@eclips16 I'm getting Could not construct ApplicationDefaultCredentials |
You need to wrote a full path of the location of your json file. It can be anywhere if you run on Linux. |
@eclips16 Unfortunately I have this error in my log, any idea? So when the intent has context(s), I get this error and nor reply. When there is no context set to an intent, it works fine. |
Any update on this pull request? Dialogflow api v.1 gets deprecated on May 31st, 2020 |
Hello Guys, I am building a WhatsApp bot that connects to Dialogflow via Twilio. I want a way for Botman to pick up specific actions or intents and execute some code, this is easy if I was using Botman directly. any pointers? |
@eclips16 Thanks you, works correctly. |
Hello, Please tell me |
Hello @eclips16 , i tried your middleware DialogflowV2 and i got this error
} |
No Bro |
@TavoNiievez can please tell me steps to link dialogflow v2 with botman |
For me it is a permission issue: check that the service account you created have the Dialog api admin and dialog api client permission and it should work |
yes i did it, i gave all permission ... but same error |
Go to your google console and create a new service account for this project. |
Ho and @E-Haroun |
thank you so much |
@eclips16 can help plz. |
@suwendrarms I am sorry but I did not get your question |
@eclips16 my project botman and dialogflowv2 connection part is done. first thanks for this .but i need add google translate for this. example view input put sinhala language massage then it translate english and add the botman process. |
@suwendrarms You need to create a botman middleware and load it before the dialogflow middleware |
@eclips16 can you show example code for botman middleware get input text and set input for translated text |
@suwendrarms you can check the doc for botman middleware here: https://botman.io/2.0/middleware |
|
@eclips16 thank you so much |
Hi @eclips16 Thank you for updating this middleware it meant a lot to us! However, I've tried to include all the files needed for DialogFlow2 in the vendor/botman/botman/src accompany with my google application credentials within the .env file, but I'm still getting no responses. Is it currently still working for you guys? Any help would be very valuable thank you so much! |
@vincent659 do you get some kind of error ? |
Hi thank you for the fast reply @eclips16 . I've got it working in the end thank you so much! |
Hi, May be useful for someone. |
Dear Eclips16, I've also put your code into an independent package: https://github.com/vincent659/botman-studio-dialogflow-v2 I also thought it would be useful for someone and thought no one had created it yet. Thank you! |
Maybe it's time to fork botman... |
Hi, I've tried to understand the middleware code and I extracted the data with a data dump on $queryParameters on line 120 in client.php but it seems like the following foreach loop doesn't cater for this setup as I'm unable to retrieve the values after this. My questions is if anyone here has successfully implemented the islist option in Dialogflow and got suggestions on how I can proceed. Thank you for any insight! |
How you get resolved this issue, i checked with absolute path but still i am getting this error: In CredentialsWrapper.php line 256: Could not construct ApplicationDefaultCredentials In ApplicationDefaultCredentials.php line 189: Could not load the default credentials. Browse to https://developers.google |
Hi I'm new to Botman and can someone ask me how to put google credentials in env? Can't seem to work it out. |
composer require google/cloud-dialogflow
environment variables to add to your .env file:
GOOGLE_CLOUD_PROJECT=project-id
GOOGLE_APPLICATION_CREDENTIALS=/path/to/project-secret.json
get your application credentials file from the google cloud console (Service account)
Drop-in replacement for the v1 Middleware
Maybe someone can help writing tests ? :)