11

I want use Google Assistant from my phone to send HTTP POST command to my server. I have a simple webnms app running over it, this server support REST API and now I want to use Google Assistant to shoot GET or POST command to that server and return my output.

Is it something possible? I am not full time developer.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
Mayank Goyal
  • 131
  • 1
  • 1
  • 3

3 Answers3

4

Yes, as @Prisoner says it is possible. It is not what you asked - but have you seen these ways that Google provides to get skills published without requiring a lot of developer savvy?

https://developers.google.com/actions/content-actions/

https://developers.google.com/actions/templates/first-app

I don't speak for them, but IMO Google's target audience for Action building apart from the above is those who have at least some familiarity with the JavaScript language and its "run-time" Node.

There is also this - which I haven't tried by the way.

https://www.techadvisor.co.uk/how-to/digital-home/easy-actions-google-assistant-3665372/

In case it is not obvious, Google Actions are essentially websites that interact with Google's assistant running on a Home device or a smart phone, say. Think of the Assistant as a browser initiating requests and your Action as serving them. If you can (build and?) deploy a server that handles POSTS over HTTPS on a publicly addressable URL, and if you can understand the JSON payload that the Assistant sends and respond with appropriate JSON to carry out you application then you are good to go.

Where you don't have a public IP address - e.g. in testing - you can use a tool like ngrok ( https://ngrok.com/ ) to reverse proxy requests emanating from the Assistant to your server.

I have slides for a presentation I did targeting fledgling developers who had never built an Action here

https://docs.google.com/presentation/d/1lGxmoMDZLFSievf5phoQVmlp85ofWZ2LDjNnH6wx7UY/edit?usp=sharing

and the code that goes with it here

https://github.com/unclewill/parrot

On the upside the code is about as simple as it gets. On the downside it does almost nothing. In particular, it doesn't try to understand language. As @Prisoner says you'll likely need a tool like Dialog Flow for that.

William DePalo
  • 615
  • 4
  • 8
3

Yes, it is possible.

Your server will need to implement the Actions on Google API. This is a REST API which will accept JSON containing what the user is intending to do and specific information about what they have said. Your server will need to send back JSON indicating the reply, along with additional information about how to continue the conversation.

You will likely also want to use a tool such as Dialogflow to handle building the conversational script and converting a user's phrases into something that makes sense to you. You'll also need to use the Actions on Google console to manage your Action and provide additional details about how users contact your Action. All of this is explained in the Actions on Google documentation.

Simple Actions are fairly easy to develop, and can certainly be done by a developer as a hobby. Good Actions, however, take a lot more thought and planning. Google offers you to the tools - it is up to you to best take advantage of them.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • Thanks for the reply,as you said "Your server will need to implement the Actions on Google API,which REST API" but my server already has REST API on it,using REST API client I can GET or POST on my server with JSON REST API calls.I did some work on Dialogflow and found that it has to go through WEBHOOKS to send HTTP POST or GOT and REST REQUEST which it sends to your URL is actually form by using parameter it gets from Conversational Script.As I sai I am not developer and may be you will get little upset from my knowledge but I wanna do it anyhow,,,any answers will be highly appreciated.Thanks – Mayank Goyal Jan 17 '18 at 14:17
  • Was there a question in your reply? I'm not sure what else you're looking for. – Prisoner Jan 17 '18 at 15:15
  • https://developers.google.com/actions/sdk/ read this carefully. If you cant understand it yet then start with some more basics so see what is written and mentioned inside and care about that first, the problem with rest is a pradigma but what is below varies so you have to make sure to response with the correct messages – shortQuestion Jan 17 '18 at 15:32
  • Since google is sunsetting the conversational actions in June, is there another way to do this? Of the four active development paths left it seems one has to go with "App Actions" and create an Android App and make REST calls from within that. – Dan Feb 13 '23 at 16:17
  • Correct, the short answer is that App Actions in an Android app are about the only path currently available to do it through the Assistant, although the experience is very different than the Conversational Actions available in 2018. (If you're looking for more details, you may wish to start a new question and tag it with "app-actions".) – Prisoner Feb 13 '23 at 18:15
  • Actually, depending on your needs and the platform you want, you may be able to build a chatbot or a telephony bot, for example, and use something like Dialogflow to process it. But these would not work through the Assistant. – Prisoner Feb 13 '23 at 18:17
1

I've found the solution. In the "Action" console https://console.actions.google.com/project/sandbox-csuite/scenes/Start Go to menu "Webhook", click "Change fulfillment method", and then select "HTTPS endpoint"

hadf
  • 279
  • 2
  • 5
  • 15