question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot send BasicCard - Actions on Google simulator

See original GitHub issue

Using 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:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Edo78commented, Apr 21, 2018

You have to call ask only one time for intent, every others time are ignored. So calling ask with the string basicCard you send a SimpleResponse to dialogflow and the BasicCard is basically discarded.

Try to remove the conv.ask('basicCard');

0reactions
omfdcommented, May 8, 2018

@sonlexqt Can you post working sample for the Carousel because I have not been able to get it to work

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found