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.

A simple response is required in addition to this type of response

See original GitHub issue

Hi,

I am having error when returning fulfillment response (A simple response is required in addition to this type of response). Following is the fulfillmentResponse

{
  "error": "A simple response is required in addition to this type of response"
}

Information

DialogFlow API version: V2 API Node version: v8.10.0 actions-on-google version: ^2.6.0 body-parser version: ^1.18.3 express: ^4.16.4

Following is the code snippet

const app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
const agent = dialogflow();
agent.intent("dummyIntent", (conv, input) => {
  if (conv.action === "dummyAction") {
    conv.ask(
      new Carousel({
        items: {
          car: {
            title: "Car",
            description: "A four wheel vehicle",
            synonyms: ["automobile", "vehicle"]
          },
          plane: {
            title: "Plane",
            description: "A flying machine",
            synonyms: ["aeroplane", "jet"]
          }
        }
      })
    );
  }
});

app.post("/webhook", agent);

app.listen(port, () => {
  console.log("Server is up and listening on port" + process.env.PORT);
});

I have tried using new Image(), new BasicCard(), all giving same error.

Your help is much appreciated.

Thanks in advanced.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ataillefercommented, Mar 28, 2019

Hi, as stated in this documentation,

Visual selection responses have the following requirements and optional properties that you can configure: The first item in a visual selection response must be a simple response.

So you need to add something like:

conv.ask('Here are some interesting machines:');
conv.ask(
  new Carousel({
    ...
  })
);

This will display a chat bubble just before the Carousel.

Regards

1reaction
crispywongcommented, Mar 28, 2019

Hi @ataillefer ,

Thanks for reply.

I had added line

conv.ask("This is category list")
conv.ask(
  new Carousel({
    ...
  })
);

This is the fulfillment response

{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "systemIntent": {
        "intent": "actions.intent.OPTION",
        "data": {
          "@type": "type.googleapis.com/google.actions.v2.OptionValueSpec",
          "carouselSelect": {
            "items": [
              {
                "optionInfo": {
                  "key": "car",
                  "synonyms": [
                    "automobile",
                    "vehicle"
                  ]
                },
                "description": "A four wheel vehicle",
                "title": "Car"
              },
              {
                "optionInfo": {
                  "key": "plane",
                  "synonyms": [
                    "aeroplane",
                    "jet"
                  ]
                },
                "description": "A flying machine",
                "title": "Plane"
              }
            ]
          }
        }
      },
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "This is category list"
            }
          }
        ]
      }
    }
  },
  "fulfillmentText": "Cannot display response in Dialogflow simulator. Please test on the Google Assistant simulator instead."
}

Chat bubble “This is category list” did not display. Instead it display fulfillmentText when using the “try it now” container. Please refer to attached image. image

When I tried with my device, it did not show any chat bubble. I have no idea where does “fulfillmentText” set. I have searched about it, does it related to middleware as mentioned in this comment

app.use(conv => {
    const { handler } = conv;
    conv.handler = async function() {
        const res = await handler.apply(this, arguments);
        const { simpleResponse } = res.body.payload.google.richResponse.items.find(item => item.simpleResponse) || {};
        if (simpleResponse) res.body.fulfillmentText = simpleResponse.textToSpeech;
        return res;
    };
});

Thanks.

Regards.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AppResponse | Dialogflow and legacy Actions SDK
SimpleResponse. A simple response containing speech or text to show the user. Plain text of the speech output, e.g., "where do you want...
Read more >
Exploring Actions on Google Responses: Simple Response
The Simple Response is a great way to as questions, end conversation or give display simple content to the user. Remember to bear...
Read more >
Responses | Dialogflow ES - Google Cloud
Agents typically use a combination of static and dynamic responses. Multiple types of responses can be provided. The basic response type is a...
Read more >
Response Options - Designing Surveys for Evaluations and ...
Most research protocols involving the protection of human subjects will require you to allow respondents to opt out at any time. However, failing...
Read more >
Creating a dialog - IBM Cloud Docs
If you added more than one response type, you can click the Move up or down arrows to arrange the response types in...
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