Cannot send BasicCard - Actions on Google simulator
See original GitHub issueUsing the actions-on-google-nodejs
v2 library, I setup the webhook to send a BasicCard:
const generateCardItem = ({ text, parkObject }) => {
const { title, subtitle, thumbnail } = parkObject;
// Create a basic card
return new BasicCard({
text,
subtitle,
title,
image: new Image({
url: `${API_ROOT_URL}${thumbnail}`,
alt: 'Image alternate text',
}),
});
};
app.intent(INTENT.PARK_BY_NAME, (conv, params) => {
const { Parks } = params;
return axios.get(DIALOGFLOW_API_URL, {
params: {
applicationid: APPLICATION_ID,
actions: 'search-park-by-name',
parks: Parks,
},
}).then((response) => {
const { data } = response;
const { speech, text, card } = data;
const parkObject = card[0];
const cardItem = generateCardItem({
text: text || speech,
parkObject,
});
conv.ask('basicCard');
conv.ask(cardItem);
}).catch((error) => {
console.error('ERROR');
console.error(error);
});
});
When I test with Actions on Google simulator, this is shown:
(the simple response is shown and the BasicCard
isn’t). When I check the console output this is what I got:
2018-04-23T07:38:40.971857+00:00 app[web.1]: Response {
2018-04-23T07:38:40.971878+00:00 app[web.1]: "data": {
2018-04-23T07:38:40.971880+00:00 app[web.1]: "google": {
2018-04-23T07:38:40.971882+00:00 app[web.1]: "expectUserResponse": true,
2018-04-23T07:38:40.971884+00:00 app[web.1]: "richResponse": {
2018-04-23T07:38:40.971886+00:00 app[web.1]: "items": [
2018-04-23T07:38:40.971888+00:00 app[web.1]: {
2018-04-23T07:38:40.971889+00:00 app[web.1]: "simpleResponse": {
2018-04-23T07:38:40.971891+00:00 app[web.1]: "textToSpeech": "basicCard"
2018-04-23T07:38:40.971892+00:00 app[web.1]: }
2018-04-23T07:38:40.971894+00:00 app[web.1]: },
2018-04-23T07:38:40.971896+00:00 app[web.1]: {
2018-04-23T07:38:40.971897+00:00 app[web.1]: "basicCard": {
2018-04-23T07:38:40.971899+00:00 app[web.1]: "title": "KINSMEN PARK",
2018-04-23T07:38:40.971901+00:00 app[web.1]: "subtitle": "Has 6 amenities",
2018-04-23T07:38:40.971903+00:00 app[web.1]: "formattedText": "KINSMEN PARK has 6 amenities: 1 Accessible Swing, 1 Baseball Diamond, 1 Basketball, 1 Playground, 1 Soccer Field, 1 Spray Pad, . What other park would you like to know more about?",
2018-04-23T07:38:40.971905+00:00 app[web.1]: "image": {
2018-04-23T07:38:40.971907+00:00 app[web.1]: "url": "https://www.image-url.com/Content/Upload/1ac37f71-a39e-4f04-9628-d02bf2a694b6/facility_photos_thumbnail/2571/196af28ae1204d47b4bc9211bcaf7847.JPG",
2018-04-23T07:38:40.971912+00:00 app[web.1]: "accessibilityText": "Image alternate text"
2018-04-23T07:38:40.971914+00:00 app[web.1]: }
2018-04-23T07:38:40.971916+00:00 app[web.1]: }
2018-04-23T07:38:40.971918+00:00 app[web.1]: }
2018-04-23T07:38:40.971919+00:00 app[web.1]: ]
2018-04-23T07:38:40.971921+00:00 app[web.1]: },
2018-04-23T07:38:40.971922+00:00 app[web.1]: "userStorage": "{\"data\":{}}"
2018-04-23T07:38:40.971924+00:00 app[web.1]: }
2018-04-23T07:38:40.971926+00:00 app[web.1]: },
2018-04-23T07:38:40.971927+00:00 app[web.1]: "contextOut": [
2018-04-23T07:38:40.971929+00:00 app[web.1]: {
2018-04-23T07:38:40.971931+00:00 app[web.1]: "name": "_actions_on_google",
2018-04-23T07:38:40.971932+00:00 app[web.1]: "lifespan": 99,
2018-04-23T07:38:40.971934+00:00 app[web.1]: "parameters": {
2018-04-23T07:38:40.971936+00:00 app[web.1]: "data": "{}"
2018-04-23T07:38:40.971937+00:00 app[web.1]: }
2018-04-23T07:38:40.971939+00:00 app[web.1]: }
2018-04-23T07:38:40.971941+00:00 app[web.1]: ]
2018-04-23T07:38:40.971942+00:00 app[web.1]: }
2018-04-23T07:38:40.971950+00:00 app[web.1]: Status 200
I think the BasicCard
is successfully sent but somehow Actions on Google simulator didn’t show the card. Any suggestions ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Basic Card is not displayed in the Google action simulator ...
I use Node-Red and the google-action-contrib to make the link beetween ation-on-google and my machine. Everything works fine, I can create a ...
Read more >[Solved]-Why can't Google Actions receive my BasicCard?-C#
That error is a broad message meaning it couldn't translate the response from your webhook into a valid response to Actions on Google....
Read more >Rich responses | Conversational Actions - Google Developers
You can use the following rich response types as part of a prompt: Basic card; Image card; Table card. When defining a rich...
Read more >Create An Action For The Google Assistant With ... - YouTube
Learn how to Create an action for the google assistant with Actions Builder ▷ How to Build a Google Assistant App using the...
Read more >Actions | Programmatic Ponderings
Building Serverless Actions for Google Assistant with Google Cloud Functions, Cloud Datastore, ... Test the Action using Actions on Google Simulator;.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You have to call
ask
only one time for intent, every others time are ignored. So callingask
with the stringbasicCard
you send aSimpleResponse
to dialogflow and the BasicCard is basically discarded.Try to remove the
conv.ask('basicCard');
@sonlexqt Can you post working sample for the Carousel because I have not been able to get it to work