0

In my first Dialogflow project, there are certain points where I've got to send some response and move on to another intent (which also sends text) directly after that.

I tried using a webhook to send that message and make a FollowupEventInput with the code below.

        final SessionName sessionName = SessionName.parse(webhookRequest.getSession());
        final WebhookResponse.Builder builder = WebhookResponse.newBuilder()
                .addFulfillmentMessages(
                        Intent.Message.newBuilder().setText(Intent.Message.Text.newBuilder()
                                .addText("This is the text I want to send.")
                                .build()))
                .addOutputContexts(
                        Context.newBuilder().setName(ContextName.of(sessionName.getProject(), sessionName.getSession(), "Oilchange-haventchecked-followup").toString()
                        ).setLifespanCount(1)
                                .build())
                .setFollowupEventInput(EventInput.newBuilder().setName("StandstillQuestion").setLanguageCode("en"));
        return builder.build();
        }

The expected result would be:

bot: This is the text I want to send.

bot: This is the text from the next intent

The result I got:

bot: This is the text from the next intent

After that, I researched what the problem was and came upon this stackoverlow question where basically the same was asked (but in Python). There wasn't a suitable answer to the question. So I decided to ask it again.

How would I solve this?

I cannot simply add the text from the one intent to the other, because there's multiple intents that have to direct to that second one.

Sairaj Sawant
  • 1,842
  • 1
  • 12
  • 16
Jasper Rosiers
  • 277
  • 2
  • 5
  • 16

1 Answers1

0

That is the expected behavior as when you set a followup event it basically tells dialogflow to trigger another work flow. But to get around this issue what you would want to do is when you set the followup event, also set a context with the first sentence that you want to say with the second sentence. Then in the fulfillment of your follow up intent, check if that context is set and has any value, if it does then say that too.

Adi.P
  • 370
  • 1
  • 12