Develop google home Actions and handled by AWS Node.js server - node.js

Hi I want to make a simple google home Action, which will be controlling a LED of my development board. But I want to host data routing and handling by AWS. I have MQTT communication running between AWS server and the development board.
I am planning to deploy a Node.js server in AWS Elastic Beanstalk or Elastic computer cloud.
But I am not sure how to connect the request make on Google Home to the AWS service. Is there good documentation for this?
If possible I want to know the options with "DialogFlow" and with "Actions API".
Thanks.

Fulfillment for both Dialogflow and the Actions API goes through a webhook that you define. This will need to be an HTTPS server, with a valid non-self-signed SSL certificate, available at a public IP address. You can run this on EC2 in a variety of configurations - whatever works best for you.
On the Node.js side, most application servers are using something like Express.js to handle some routing and middleware processing. The libraries from Google assume that you'll be passed a request and a response object that have been processed using Express.js and through the express body parser to turn the JSON HTTPS body into a Javascript object. However, you don't need to use these libraries if you don't want - you just need to parse and respond with JSON.

Related

Is there local Accepted Tunneling Solution To Test Facebook Webhooks

I am integrating WhatsApp with Django application that I am still running locally to send WhatsApp which is working fine.
However to receives messages from Facebook it needs a webhook that I have implemented using Django since I am still building the application locally. on my laptops I am using Tunneling solutions Ngrok and LocalTunnel to expose the application online so that Facebook can send incoming messages to my App onto my laptop but Facebook is rejecting URLs that are I created using Ngrok and LocalTunnel with error message below:
The url https://2y7y-56-897-3-457.eu.ngrok.io/apv/facebook has been identified as malicious and/or abusive.
The url https://great-finds-comes-78-673-8-897.loca.lt/apv/facebook has been identified as malicious and/or abusive.
I have two questions:
Has anyone been successful using Ngrok and Localtunnel while building locally on Facebook webhooks?
what other tools are there that are available on windows to achieve this? I don't have a dedicated domain name yet and dedicated cloud/online platform where I can host the app yet.
The other alternative solutions I have seen that have been mentioned, it's the Ultrahook though the client is available as a Ruby gem that I have failed to get running on windows:
I was following this question: Can i use localhost as a URL Callback in a messenger webhook

Google Speech2Text - firewall blocking request

My client has a functionality in the App where it converts an audio file into text. For this, I am using the Google Cloud Speech to text API. The client has a VM setup where there is no internet connection available, and all the network traffic should go through a proxy if it needs to connect to the internet. The SpeechToText API calls don’t go via the proxy, but directly hit the firewall, which in turns blocks it and the translation fails.
I looked for ways for using global proxies in the APP, which didn’t work as these calls are gRPC based and not REST based. Looked on gRPC code as well for the proxy settings and used one of the environment variables that they provide for the same, but even that didn’t work.
I also tried to check in the Google Speech To Text client libraries if they provide proxy related settings, but even there is no solution for that.
The Google Cloud API calls use gRPC and gRPC protocol is using HTTP/2 which doesn’t seem to provide proxy based control.
I already tried to follow the steps in the instructions, however it's still not working to send the traffic via the proxy.
Any ideas what else I can do?
https://medium.com/google-cloud/accessing-google-cloud-apis-though-a-proxy-fe46658b5f2a
https://developers.google.com/gdata/articles/proxy_setup

How does one connect to a digital-ocean server from a local React project?

Background
I am working on the front-end of a project using React. The backend is saved on digital ocean, something for which I am a complete novice at, however I have made attempts to read as much as possible. I would like to be able to connect and make calls to the server from my local React project while I'm developing and testing. All that I have been given is the login details to the digital ocean droplet. My problem is that I am not sure what url/endpoint to use to make these calls.
What I've Tried:
Making calls to the ip that was given to me for accessing the droplet. e.g.: "http://148.41.158.149:8080" - this is not the official ip, just an example. I found out that this is wrong.
Using root#projectname:~# nslookup localhost, I used the ip given which didn't work.
I did manage to download the backend from the server and I can make calls to "http://localhost:8080", however I would like to know how to make calls to the server.
From what I understand, I need to retrieve the url for the server from the actual account. Is there any way to get this from the droplet?

Problem running Express app over HTTPS on aws

I have an ExpressJS backend and I want to run over https on aws (so I don't get 'mixed type content' error when trying to connect with my frontend which runs over https), it's running great using http but when using https it doesn't work.
I asked this question before and I got answers like 'use nginx', 'use load balancer', unfortunately I don't know much about this stuff as I'm not very experienced with all aws variations and options, are there any tutorials I can follow step by step ? or any easy way to serve my backend over https without complexity?
any easy way to serve my backend over https without complexity?
The easiest way (don't confused with the cheapest way) is to change your EB environment to load-balanced one. You can do this in EB console's configuration settings.
This change will create Application Load Balancer for your app, and place it in-front of your instance. Once ALB is running you can follow this AWS guide:
How can I configure HTTPS for my Elastic Beanstalk environment?
In the above, only section Terminate HTTPS on the load balancer would be relevant.
Depending on the nature of your application, is it fully dynamic, or more on static side, you could also consider using Using Elastic Beanstalk with Amazon CloudFront, instead of using ALB. CloudFront could be also be easily setup to use HTTPS between clients and CloudFront, but the issue is that traffic between CloudFront and your EB instance would go over the internet unencrypted (HTTP). Obviously, you could make it HTTPS, but this requires further changes and configurations which does not fall into category of "easy ways".

Why are there multiple POST requests with /FotorShopSurpport API on my AWS Elastic Bean Stalk node server?

I see multiple POST requests throughout my logs:
POST /FotorShopSurpport/fetchModulesByAppkey
POST /FotorShopSurpport/fetchRecommendResource
POST /FotorShopSurpport/batchResourcePkgNumByType
I don't have any API matching that route neither am I calling this APIs on my server. I recently created this server and no one even knows link to the server apart from me.
Is this something Elastic Beanstalk doing? Or is it totally different?
I have several other servers through elastic beanstalk and these requests are the first time I have seen in any logs.
Found some access logs containing "FotorShopSurpport" on google. The requests are for store.fotor.com.
$ host store.fotor.com
store.fotor.com is an alias for elb-store-376424179.us-west-2.elb.amazonaws.com.
elb-store-376424179.us-west-2.elb.amazonaws.com has address 52.34.194.249
elb-store-376424179.us-west-2.elb.amazonaws.com has address 35.160.57.75
Some client trying to access store.fotor.com is using the wrong IP, maybe because of too agressive caching. ELB keeps changing IPs. I have seen such request in my access logs too. Make sure your webserver is configured to only serve requests for your own hostnames.

Resources