Use API Response from a website on a Google Assistant Action - actions-on-google

For the context, I'm using public transport everyday. My city got an app to check the trains/buses and even a public API.
With Assistant Snapshot on my phone it tells me at which time I should leave for work, but I don't have precise timetable (especially for buses) and it's only for work.
At some point Maps used to give me the next buses at my closest station but it's gone (i don't know why)
So I decided to build an Assistant Action to ask for the next bus/subway/train for a particular line, and wanted to use their public API for this. The first time ask the user their favorites lines/stations for example.
Is it possible ?

Yes, it is possible. You can start with a conversational action and use a webhook to call their public API and return the results in rich response like a table.

Related

Skill closing and google opens recipe

We are developing interactive audiobooks for voice and have problems with some of our continuations with google assistant.
Example: In our story "Das tapfere Schneiderlein", the user hast to decide if he wants "Pflaumenmus" (plum butter) or "Apfelmus" (apple puree).
In the Test-console, everything works fine, both answers lead to the correct audio.
BUT with Google Assistant on Mobile device, only Pflaumenmus works. If I answer "Apfelmus", the action leaves conversations and opens Apple puree recipes with Google search. (see example image below, it's German, but still understandable I guess)
As we can never now, what our customers might answer, how can we prevent this from happening? (We are using Actions Builder.)
Example
This might be a result of an update regarding the Google Assistant Actions fallback intent behavior change that we announced on October 15/2020.
Follow the message from Google to make it work as you expect:
In order to provide a better experience, we now allow users to ask for some Assistant features, such as the weather or time, from within your Action. To perform this function, the Assistant detects if your Action matched a user's query with a fallback intent or NO_MATCH intent. If that is the case, and an appropriate response is available, Assistant responds to the user's request. If no response is available, or Assistant doesn't understand the query, the conversation continues within your Action.
As of October 15, 2020, this new behavior applies only if the fallback does not use a webhook. Starting January 15th 2021, we'll start enabling this feature for any Dialogflow fallback intent or Actions Builder NO_MATCH intent whether or not they use a webhook.
This change should not impact the operation of your Actions, unless you are using fallbacks as a way to collect input from your users. Going forward, you should only use fallback intents or NO_MATCH intents as a way to reprompt the user in the context of your Action. If you want your Actions to attempt to capture data from a wider range of user responses, create an intent that uses a Free form text type if you use Actions Builder. If you use Dialogflow, add an intent with a #sys.any type as the training phrase.

Main differences between a Smart Home action and a DialogFlow action

I'm just trying to figure out the main differences between these two types of actions. I mean a action that's use DialogFlow seems to be more conversational and more customizable. How does the Smart Home action handle the conversation? Is that a standard conversation based on the target device type?
When to create a Smart Home action and when to use DialogFlow?
To understand the difference, you need to understand the difference between a smart home action and a conversational action.
Conversational Actions
This is where the user initiates a conversation with "talk to X". Your action gets a WELCOME event. Then the user says more things and your action needs to process the user query and provide a text-based response.
Smart Home Actions
With the smart home integration, the user just gives a command directly. "Turn on my lights," for example, without precluding that with a "talk to" statement. Another big difference is that Google processes the user's query directly. Your smart home action does not get the user's text. Instead, there's a JSON request that specifies the user's intent.
The text that comes back is generated from Google as well, with parameters from your integration. Saying "turn on my lights" will result in "Ok, turning on lamp" or "Sorry, your lamp is offline" depending on what response your fulfillment sends.
There are a number of device types supported out of the box, as well as many traits. Traits specify the types of things that a device can do, such as turning on/off, or changing color. The traits are not explicitly tied to type, eg. you could change the color of a vacuum.
When to use each
If you're building or integrating a device that is meant to work with the Google Assistant, I'd suggest you look at smart home first. It will give users a better experience in being able to directly send queries, and it will make it easier for you to build fulfillment as the requests are structured already.
However, if it will not work for your application, you would want to look at Dialogflow, which will give you a greater level of flexibility in what the user can say.

Can I trigger a Google Assistant action without a conversation?

I'm trying to develop an action for my Google Assistant. I'd like for it to be fire and forget type deal (i.e. 'Add x to my todo list').
The problem is, the assistant won't recognise the command without me first starting a conversation with the assistant app that the action exists within.
(Hey Google, I want to talk to ... )
I'm using webhooks to call a webserver that will handle the request.
I can't use IFTTT in this instance as it needs to be available for everyone in my home. (IFTTT actions are private or public to EVERYONE)
Is there any way to trigger an action without having to say anything else (besides 'Hey Google')?
There's a few ways to complete a quick action. There is implicit triggering, when your action gets matched based on a certain set of requests.
You: Hey Google, add paying taxes to my to-do list
Google: Ok, for that you may want to try talking to My App.
You: Okay
My App: Ok, added paying taxes
That may work, although still may require an extra step with the Google Assistant. Alternatively, you can also launch a specific intent in a conversation without a full conversation.
You: Hey Google, tell My App to add paying taxes to my to-do list
Google: Ok, getting My App
My App: Ok, added paying taxes
A third alternative would be to use the Google Assistant shortcuts feature which will take something you say and interpret that as something else. It only works for static utterances, so it may not work in your case.
You: Hey Google, add paying taxes to my to-do list
Google: Ok, getting My App
My App: Ok, added paying taxes
In this scenario, you'd need to have the shortcut "add paying taxes to my to-do list" to be interpreted as "tell My App to add paying taxes to my to-do list".
If this is designed to be used by several people in your home, you may need to think about how and whether each account should be able to access the same lists.

Send text updates from website?

So say a website has been updated, or some such statistic was put in (by a third party). Now, if I wanted to get this statistic sent to my phone (and this wasn't an option on the website), what would I do?
My first inclination would be to check if this site has a public API to pull information from. If that is so, you could make a server application that polls the API and sends you the data through an sms service like twillio.
I think this would be the most simple and straightforward approach.

reverse geolocation with open graph action

I am developing an application which has an associated lat,long with the action in open graph. Presently, the api only allows for a place, so I have created my own location object which can be a property of the action.
The problem I perceive here is that this will not form part of the action in a very Facebook way.
I do not want to use Facebook places, nor do I want to have the use create a place when performing an action.
I don't need a lot of granularity, instead, just need "near $locality", such as a village name or national park if no residential addresses exist. This seems to be what happens with the Facebook messages.
Do we know a way of getting low fidelity data from Facebook or other (free) source which allow for locality information to be attached to an action?
Cheers