How to develop google actions locally? - actions-on-google

My question might sound basic or lame to you but I really have zero experience with this. I am so new to Google Actions and I don't have that much idea with Javascript. My question is how do I develop a Google Action without using the online editor google provided? Can you please narrate it to me step by step? I tried enrolling myself in codelab exercises that I hope might help me but in the codelab exercise, there was already a bunch of codes I cloned from github and that was what I used to make it all work. But now that I want to code for our real project, I don't know how to start from scratch. I know how to create an agent and stuff.. but I don't know how to develop locally. PLEASE HELP ME. THIS IS FOR OUR THESIS.

If you have followed the Build Actions for the Google Assistant (Level 2) codelab, you'll see that it talks about setting up for local development in step 3 using Firebase Cloud Functions. If you scroll down to part 4 on that page, what follows replaces some things in part 4.
Instead of typing firebase deploy as it suggests, instead type
firebase serve --only functions
What this does is, instead of sending the code to the server, you run the code locally in an environment that emulates the Firebase Cloud Function configuration. It will show the full path that is available on localhost. If your function is named something like "webhook", it will show something like:
functions: webhook: http://localhost:5000/your-project/us-central1/webhook
This now lets you use the ngrok command in another window with something like
ngrok http 5000
and that window will show the URL and hostname that are the external point. So it might be something like:
forwarding https://8ba32042.ngrok.io -> localhost:5000
You would combine these two to make the URL that you should use as the fulfillment webhook URL. Using our example, it would be something like
https://8ba32042.ngrok.io/your-project/us-central1/webhook
that you would put into the Dialogflow fulfillment URL setting.
You can then stop and start the local firebase hosting as you change things in your code and examine the request and response using the ngrok console. If you ever stop the ngrok command line, when you start it again you'll get a new hostname, and you'll need to change this in Dialogflow as well.

Download NGROK
Download NODEJS
Develop a local webhook using Express on NodeJS
Expose this local webhook to the internet using NGROK
Use the NGROK generated URL as the fulfilment to your Dialogflow agent.
Integrate Google Assistant with Dialogflow and test it.
Here is a tutorial to start with

Related

capacitor app log local ip address in offline request

I would like to log the ip address in some requests. For this i would like to get the info from the network-interface in my app. As it is a offline app that replicates to couchdb and not server requests this is proving to be difficult.
i was thinking of using #capacitor/network but this plugin only tells me if there is a network connection and no infos.
Then i tried cordova-plugin-networkinterface but i could not get this plugin to work properly because it does not show in cordova.plugins like cordova-plugin-badge.It does show up in the window object as window.networkinterface.getIPAddress() but it returns "undefined".
Can someone please tell me why cordova-plugin-networkinterface does not work in capacitor (not using ionic) or a different approach.

How to use Google Action Builder with my own server

I want to develop an action to google assistant. So i red the documentation here https://developers.google.com/assistant/conversational/overview and i followed this tutorial https://www.youtube.com/watch?v=Z1hxvniJ18s
It s worked and i was allow to develop and test my app in the simulator. The problem is that when it's come to webhook i don't totaly understand how it's work. On the webhook icon i got this
The seconde one allow me to use Google cloud function and firebase but i had to add my billing account to make it available. I also get a console where i can code my fonctions and my responses.
And if i am correct, the first one allow me to connect to my own Api. But i can only enter one field that is the URL adresse and nothing else so how do i code it? Also i see everywhere people using node.js and i would like to use php is it possible?
To sum up my problem, i would like to know how i could connect my action builder to an other service(Api) than google ones? If it's possible to run my server in php and how do i interact with my google action?(I think it's by sending json back and forth but i'am not sure how to do it?) Finally i would like to know if it's possible to test it in local server with mamp and phpmyadmin for exemple to test the answer of the server?
I would be very grateful if someone could help me, show me how to set up all this.
But i can only enter one field that is the URL adresse and nothing else so how do i code it?
When you develop your webhook, you will need to have a single publicly accessible endpoint to connect with. This endpoint will receive an HTTP POST request and you will need to respond with an appropriate response.
Also i see everywhere people using node.js and i would like to use php is it possible?
Any language that can run on a web server can work. Node.js is one that is used a lot, but PHP can work just as well. You can create an actions.php file and then enter an endpoint address https://example.com/actions.php that will be called. You may need to refer to the Request and Response reference for the expected format.
if it's possible to test it in local server with mamp and phpmyadmin for exemple to test the answer of the server?
It's somewhat possible. You'll need to have some method of sending mock requests to your local server, which might be as easy as using cURL or other tools like Postman.
Unfortunately my personal experience with PHP tools is limited, so I can't necessarily walk-through the specifics. But it does seem like you know these tools a bit more and should be familiar enough to be able to get started.

Simple Localhost Server in Xcode/Swift?

I am making a macos app in XCode, and I was wondering if there was a way to make it host a local server that is visible across the network.
I am trying to find a way so that it would host something on the devices's network with it's hostname/ip address, so if someone goes to http://hostname:5000 they would be able to see the response, and the app would be able to see the request, just like how hosting a local python server works. Is there any way to do this in XCode with Swift?
For example: the user presses 'start server' on their screen. The server is hosted across the network. Anytime a request is made to it, they get a notification.
Just to make you concern you may find some sample codes, including local web server inside the app.Few of them I found are:
https://github.com/ooper-shlab/MyWebViewApp-Swift
https://github.com/depoon/SwiftLocalhost
The main thing is it's just a public
, experimental code, so it's not simple, not easy to adopt, not all coding best-recommended, far from readable and may have severe bugs.But you can use it as a working example and take any parts of it into your app.

How to configure Big Blue Button for Xirsys TURN server?

I run an self-hosted instance of BigBlueButton and signed up for Xirsys TURN server services because we need to serve clients behind (pretty restrictive) firewalls. Before I had been running my own instance of coturn, but as this led to problems recently, I thought I will got someone who does this for a living a try.
Now the configuration in BBB is explained here:
https://docs.bigbluebutton.org/2.2/setup-turn-server.html
Yet so far I completely failed to match the parameters I receive from Xirsys with what I have to put into the /usr/share/bbb-web/WEB-INF/classes/spring/turn-stun-servers.xml file in the place of the <turn.example.com> and <secret_value>.
Did anyone ever make this work? I did try and find a tutorial but also failed.
bbb_web, is returning this the turn uris. passwords to the html5 client, that the client is using in sip.js
so you can either get bbb-web to send valid username/passwords is same method is used, or modify the html5 client to make a Xirsys api call, to get access to the turn candidates.
Would need to look at api docs. twilio has a similar service.
regards,
Stephen
not the most elegant solution but the easiest one for me:
modify the final bbb js bundle to load the stunturn info from a fixed url in
e.g.
/usr/share/meteor/bundle/programs/web.browser/f30716b2b57e2862c4db2325 b7aac63f4622842b.js
the minified part should then look somewhat like:
const r=Meteor.settings.public.media,i='https://<yourbbburl>/html5client/stunturn.json',a=r.cacheStunTurnServers,s=r.fallbackStunServer;
and put either the static credentials or generated ones in a file stunturn.json besides the js bundle.

Deploying a web service to my Google App Engine application

We made a simple application and using GoogleAppEngineLauncher (GAEL) ran that locally. Then we deployed, using GAEL again, to our appid. It works fine.
Now, we made a web service. We ran that locally using GAEL and a very thin local python client. It works fine.
We deployed that, and we get this message when we try to visit our default page:
"Move along people, there is nothing to see here"
We modified our local client and tried to run that against our google site and we got an error that looked like:
Response is "text/plain", not "text/xml"
Any ideas where we are falling down in our deployment or config for using a web service with google app engine?
Any help appreciated!
Thanks // :)
Looks like you're not setting the Content-Type header correctly in your service (assuming you ARE actually trying to send XML -- e.g. SOAP, XML-RPC, &c). What code are you using to set that header? Without some indication about what protocol you're implementing and via what framework, it's impossible to help in detail...!
Looks like we aren't going to get to the bottom of this one. Just not enough information available at debug time. We've managed to affect a fix on the service, although I hate ot admit it we never found out what was causing this bug.