Is it possible to integrate Google Assistant with my custom app? - google-assistant-sdk

I would like to integrate Google assistant inside my app. The idea is that I have a app which provides various press services, like giving latest news and such. I would like to integrate Google assistant for handling some particular requests. For example the user may ask, "what did the Lakers yesterday?" If i search this on Google or ask to the assistant, i will get a card with the score of yesterday's game. I would like, from inside my app, to replicate this interaction, that is sending the request to Google assistant and showing the answer that Google return to the user (or at least opening Google assistant with the answer)
Is such a thing possible?
I was looking at Google Assistant service sdk (https://developers.google.com/assistant/sdk/guides/service/python/) and it says:
The Google Assistant Service gives you full control over the integration with the Assistant by providing a streaming endpoint. Stream a user audio query to this endpoint to receive a Google Assistant audio response.
Is this possible only with audio interaction? I'm not quite certain this is the solution I should look into

The Google Assistant SDK Service allows you to send both audio or text to the Assistant and you'll get back responses including audio, display text, and rich HTML visual content.
For mobile apps, there's less support compared to Python, but it's still doable. For example, there's a version of the SDK for Android Things, which means for IoT devices like a Raspberry Pi. You can go through this project and remove all the IoT references, but it's something you'd need to do yourself.

Related

Communicating with Google Home and Google Assistant with the Application We Developed Instead of the Smart Home Device

I work for a company that develops a smart home device.
The company is developing an android application for smart home devices it has developed/designed.
In addition, he wants to control the smart home devices he has developed with the Google Assistant.
We currently cannot use "Custom intents" for the "Voice-enable your Android app" feature. I wish we could add google assistant feature directly to our software independently (without any google home or nest affiliation)... (https://developers.google.com/assistant/app/custom-intents)
custom intents; It is not specialized for Smart Home and is not used in local languages ​​such as Turkish.
We are focusing on the Google Assistant feature for Smart Home. (https://developers.google.com/assistant/smarthome/overview)
Scenario 1: There is a way that Google communicates with the developer cloud via Access Token. (https://developers.google.com/assistant/smarthome/concepts/fulfillment-authentication)
Scenario 2: There is also a second way. Here google assistant is communicating with a google home or google nest device (rather than developer cloud).
(https://developers.google.com/assistant/smarthome/concepts/local) Obviously something strange is going on here. Google Assistant; It says it will contact google home. Is it the google home app installed on the phone he's talking about here, or a google home app like a speaker? Because at https://developers.google.com/assistant/smarthome/concepts/local#supported-devices, a speaker is shown as google home. If it's not talking about the google home app on the phone, or if it can't communicate with the google home app on the phone, it's not much use to us. Because the user may not have a physical google home product/device.
Neither of these scenarios fits exactly what we want to do. What we want to do is exactly this; Google Assistant should neither communicate with our cloud (to avoid lag) nor should it communicate with a google nest device (because the user may not have such a device). It should communicate directly with our app installed on the user's phone. Google Assistant or Google Home; should tell our application the purpose to be fulfilled. Let's send the request sent to us by google assistant or google home to our device or cloud (whatever options are possible).
Is there such a feature in the local home SDK of Google Assistant? Or is there another way google assistant can communicate directly with our app?
Because it is frankly very strange that google home or assistant try to communicate directly with a smart device when our app is installed on the user's phone. It can communicate with our cloud server, but why can't it communicate with our application installed on the phone?
Google assistant or google home; can communicate directly with our application installed on the phone while registering the first account instead of our oauth 2 server. Google is linking to our app instead of using oauth 2 directly. Our app connects to oauth 2 and gives a token to google. In other words, the user can make a sync with our local application on his phone. https://developers.google.com/assistant/smarthome/develop/implement-app-flip#implement-app-flip-in-your-native-apps
But I also think that in order to control smart devices, the user would have to communicate with our application installed on his phone.
Is there a way to this?
The platform does not support a way to directly control a smart home device through an app installed on a phone. Counter to your scenario, there are times when a person wants to control their device when their phone is not around.
Local Home SDK integrations are in addition to an existing cloud integration. This base cloud integration is needed in the cases that a person is not at home.

difference between "work with google assistant" and "built-in"? thanks

Is there any doc or people can tell me the difference between "work with google assistant" and "built-in"? If a new smart device going to add google assistant in, what should we do based on these 2 different ways?
Building IoT devices for the Google Assistant fall into two categories.
You can have the Google Assistant built into your device. This would let you talk directly to your device and invoke custom device actions. It would not really integrate with a consumer's existing devices.
Alternatively, you can work with the Google Assistant. This would be for a device that you control using an existing Google Assistant surface like a Google Home or a phone. This simplifies the integration work, as you don't need to worry about all the voice management, and may be better for integrating into other voice ecosystems.

Cannot run Google Home assistant routines by conversation relay

I'm using google assistant relay (https://github.com/greghesp/assistant-relay/) on Raspberry PI. My objective is to allow my automation (jeedom) server to run Google actions. For basic instructions, everything is ok, such as switch on the light of a room. But when trying to run a Google Home routine command (for example, "lunch time" that should light on living room, light off tv room) assistant doesn't run routine but answer such as if routine was not existing, for example it tries to search for a restaurant named "lunch time".
I registered a device (obtaining model id and device id) and put reference of this device in the relay system but it does not work better, same result.
In Google Home app, I set for this device permission to execute with personal data but same result.
I expect to launch routines with my relay in order to allow my jeedom server to put some advanced tasks to Google.
Developer of Assistant Relay here.
I'm not sure if the triggering Routines is a SDK limitation or not. Some people seem to have had success with Hass.io's integration, however I've not managed to get it to work (not looked into it too much)
I'm working on V3 so will see if I can get it working

Google Voice Actions, Home, Actions, Assistant

Please can somebody give a short summary/difference between Google Voice Actions, Home, Actions and Assistant (Dialogflow)? I would like to control my android java application via google assistant/home, but I'm having hard time finding something I can start with.
If you are building something for the Google Assistant, you will use Actions on Google. This is a cloud-based platform for AI-powered interactions. An action can take a user's intent, either through text or a transcription of what they said, and return a useful result.
Most people are not experts with natural language understanding, so they can use Dialogflow. This service gives developers the ability to easily match the user's intent and identify entities through what they said.
Once you build an action, you can publish it for the Google Assistant. This is a platform that is available on a variety of surfaces. Surfaces include Google Home as well as your phone.
If you are interested in building a device that embeds the Google Assistant or want to add the Google Assistant to your application, you can use the Google Assistant SDK. This allows you to make requests to the Assistant and present the response to the user.
Depending on what you are building, the tools you will use can vary.

How can I get Alexa working on my iOS app?

I have been checking out the Alexa Skills kit the past few days. I have also been poring through the documentations for both the Skills kit and the Voice Service. I am just having a little hiccup trying to understand the flow. I have implemented one of amazon's sample skills (favourite colour sample) in the developer console and also wrote a sample lambda function to handle the type of response that will be delivered. Its working on the test simulator and what left is basically getting lambda running through my ios app. However I have the impression that I don't have to use the voice service. Am I wrong? I am quite confused, it would be awesome if anybody who has some more clarity could shed some light on the matter. If I get lambda working also, I think it will accept requests that are in a particular format. Where do I have to send the encoded audio to get a json response to send to the skills kit? To the Alexa Voice Service?
Also I am authenticating my app using cognito and dynamo db. If I were to use Alexa Voice Service, then it is mentioned that the user will have to also login to amazon. So do I still have to work with the login with amazon sdk? Or is there a workaround?
Based on Amazon documentation there are two ways to interact with Alexa:
Sounds like you want to implement the app thru the Companion method.
As far as the JSON goes, i am currently resolving that issue now, (will post answer once I have it resolved).
Basically you have to use AVFoundation to capture audio from iPhone and send 2 https messages to Alexa (One message with JSON Body & the second message with audio captured as body.) Bases on Documentation
Companion App
(You have a device (such as a smart speaker) that you want to add Alexa to. So, you build in support for AVS. Great! Now you need a way to authorize it and associate it with the user's account. This is the "companion app" approach. The companion app connects to your smart product and allows the user to login and authorize the speaker to use Alexa and connect to their Amazon account.)
Mobile OR Website
AVS App
(You don't have a device you need to authorize - instead you want to speak to Alexa from within your Android/Iphone application.)
Android or Iphone
You can find a swift example on github on how to implement a iOS AVS client
https://github.com/chintan1891/iOS-Alexa

Resources