Janka
Janka

Reputation: 1988

DialogFlow V2 How set fulfillmentText via node js library?

Following this guide:

https://actions-on-google.github.io/actions-on-google-nodejs/

I created an action for DialogFlow

import { dialogflow, Image, Conversation, BasicCard } from 'actions-on-google';
const app = dialogflow();

app.intent('test', (conv, input) => {
    conv.contexts.set('i_see_context_in_web_demo', 1);
    conv.ask(`i see this only into actions on google simulator`);
    conv.ask(new Image({
url: 'https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/imgs/160204193356-01-cat-500.jpg',
alt: 'cat',
    }));
});

I then activated Web Demo integration

I saw that the Web Demo integration does not show the cards, the images. I hypothesize that it only shows text, no rich text

I understand that it elaborates only JSON like this:

{ "fulfillmentText": "Welcome!", "outputContexts": [] }

But I did not find any method in the library used to enhance fulfillmentText

can you help me?

Upvotes: 0

Views: 611

Answers (1)

Prisoner
Prisoner

Reputation: 50731

You're using the actions-on-google library, which is specifically designed to send messages that will be used by the Google Assistant. The Web Demo uses the generic messages that are available for Dialogflow. The actions-on-google library does not send these generic messages.

If you want to be able to create messages that are usable by both, you'll need to look into the dialogflow fulfillment library, which can create messages that are usable by the Google Assistant as well as other platforms. Be aware, however, that not all rich messages are available on all platforms, but that the basic text responses should be.

You also don't need to use a library - you can create the JSON response yourself.

Upvotes: 1

Related Questions