Dialogflow-fulfillment-nodejs: how do i send response in ssml?

Created on 25 Oct 2018  路  7Comments  路  Source: dialogflow/dialogflow-fulfillment-nodejs

in action on google library i used to do it like this:
image

so when I'm doing agent.add('Welcome to the temperature converter!');
what options do i have for ssml?

Most helpful comment

@malikasinger1

A firebase example:

const functions = require('firebase-functions');
const {WebhookClient, Card, Suggestion, Text} = require('dialogflow-fulfillment');


const handler = (req, res) => {
  const agent = new WebhookClient({ req, res });

  function intentHandler(agent) {
    agent.add('This message is from Dialogflow\'s Cloud Functions for Firebase editor!');

const wakeUpText = new Text('Waking up...');
  wakeUpText.setSsml(`
  <speak>
    <audio src="https://example.com/sounds/chirp.ogg">chirp...</audio>
  </speak>
`);
  agent.add(wakeUpText);

    agent.add(new Card({
        title: 'Title: this is a card title',
        imageUrl: 'https://developers.google.com/actions/assistant.png',
        text: 'This is the body text of a card.  You can even use line\n  breaks and emoji! 馃拋',
        buttonText: 'This is a button',
        buttonUrl: 'https://assistant.google.com/'
      })
    );
    agent.add(new Suggestion('Quick Reply'));
    agent.add(new Suggestion('Suggestion'));
  }

  agent.handleRequest(intentHandler);
};
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(handler);

Without firebase... (using some other server for the web hook)...

server.post('/api/actions-on-google', handler);

All 7 comments

*Text not test (in the photo)

any one?

any update?

@matthewayne can you write down code example here?

@malikasinger1

A firebase example:

const functions = require('firebase-functions');
const {WebhookClient, Card, Suggestion, Text} = require('dialogflow-fulfillment');


const handler = (req, res) => {
  const agent = new WebhookClient({ req, res });

  function intentHandler(agent) {
    agent.add('This message is from Dialogflow\'s Cloud Functions for Firebase editor!');

const wakeUpText = new Text('Waking up...');
  wakeUpText.setSsml(`
  <speak>
    <audio src="https://example.com/sounds/chirp.ogg">chirp...</audio>
  </speak>
`);
  agent.add(wakeUpText);

    agent.add(new Card({
        title: 'Title: this is a card title',
        imageUrl: 'https://developers.google.com/actions/assistant.png',
        text: 'This is the body text of a card.  You can even use line\n  breaks and emoji! 馃拋',
        buttonText: 'This is a button',
        buttonUrl: 'https://assistant.google.com/'
      })
    );
    agent.add(new Suggestion('Quick Reply'));
    agent.add(new Suggestion('Suggestion'));
  }

  agent.handleRequest(intentHandler);
};
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(handler);

Without firebase... (using some other server for the web hook)...

server.post('/api/actions-on-google', handler);

Is it possible to avoid tag marks in Dialogflow web demo? I meant drawl but without showing marks?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

newtonmunene99 picture newtonmunene99  路  3Comments

mukuljainx picture mukuljainx  路  5Comments

aringlot picture aringlot  路  5Comments

shivam-k picture shivam-k  路  7Comments

KirillMoizik picture KirillMoizik  路  3Comments