简体   繁体   中英

Whats the easiest / free way to be able to make a post request to a self hosted endpoint through google assistant

A while ago I wrote a backend to trigger my automatic cat feeder through a post request. Now I was trying to make it so that I could say 'Hey Google, feed my cats' and as a result, the post request would be made.

I am struggling a bit more with this than I'd like, and I have tried the following things:

  1. I use an app called 'HTTP Shortcuts' I can open this app with the assistant, but then I would still have to click the shortcut I want myself, which is not good enough. I have pinned the shortcut to my home screen, and named it 'Feed Cats' but if I say Hey google, feed cats, it does not trigger.

  2. Due to 1 not working, I was thinking well, if I can open the app, then I could create an app that starts up, makes the post request, and exits again, then I could just say hey google open {app name} and it would do the same thing. After having made the app, I verified that it did indeed feed and close, but then I noticed that if I say hey google, open {app name} it does not work, and it just googles it instead.

I'm guessing this is due to my app just being a development app and never having made it through review?

Is there a better way to handle this?

If your server that can accept a POST is reachable from the outside world, there are a few other approaches that you can take.

  1. You can create an IFTTT applet that takes a phrase that you've said to the Google Assistant and makes a web request (with optional parameters) to your cat feeder.

  2. If you want to learn a bunch of new stuff, you can learn how to make an Action . (Which is Google's term for an app for the Assistant.)

    • This could be a conversational action which takes phrases, sends JSON to a webhook you designate, and receives replies which are played through the Assistant.

    • Or, if you can find a suitable device, you may wish to explore what making a Smart Home action for the cat feeder might be like.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM