티스토리 뷰

 

1. Dialogflow의 상태

2. Webhook의 상태


// Welcome intent.
// V2, It use intent name, not action name.
app.intent(WELCOME_INTENT, (conv) => {
  console.log("WELCOME_INTENT");
  // for debug. If you want debug, copy and paste.
  // conv is json data.

  conv.ask('plat it');
  conv.ask(new MediaObject({
    name: 'Jazz in Paris',
    url: 'http://storage.googleapis.com/automotive-media/Jazz_In_Paris.mp3',
    description: 'A funky Jazz tune',
    icon: new Image({
      url: 'http://storage.googleapis.com/automotive-media/album_art.jpg',
      alt: 'Media icon',
    }),
  }));
  conv.ask(new Suggestions(['play']));

});


// actions_intent_MEDIA_STATUS를 intent를 받는 dialogflow에 넣어야 한다.
app.intent('actions.intent.MEDIA_STATUS1', (conv) => {
  console.log('MEDIA_STATUS1')
  const mediaStatus = conv.arguments.get('MEDIA_STATUS');
  let response = 'Unknown media status received.';

  if (mediaStatus && mediaStatus.status === 'FINISHED') {
    response = new MediaObject({
      name: 'Jazz in Paris',
      url: 'http://storage.googleapis.com/automotive-media/Jazz_In_Paris.mp3',
      description: 'A funky Jazz tune',
      icon: new Image({
        url: 'http://storage.googleapis.com/automotive-media/album_art.jpg',
        alt: 'Media icon',
      }),
    });

  }
  conv.ask('plat it');
  conv.ask(response);
  conv.ask(new Suggestions(['play']));
});


이렇게 하면 된다.


공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함