티스토리 뷰

Event


1. google assistant 에서 만들어 놓은 챗봇 built-in intent


예를 들면 actions.intent.CANCEL : 취소, exit, cancel 등을 말하면 나가는 인텐트

actions.intent.CONFIGURE_UPDATE 같은




2. 자체 제작 이벤트

는 아직 잘 모르겠다.



1. built in intent를 사용하는 방법


예제 :  actions.intent.CANCEL





STEP 1.

후에 Fullfilment 와 연결해주기 위해서 ( action on google client library api 버전 2 의 경우 intent 이름이랑 연결된다.)

1)이름을 say_bye

2)built in intents actions_intent_CANCEL 을 이벤트로 넣어준다.

참고 문서 : https://developers.google.com/actions/assistant/app-exits


이벤트가 트리거가 되면 바로 이 인텐트가 실행되기 때문에 Training phrases 이자 users expression 인 사용자의 말 부분에 아무것도 적지 않아도 된다. 


공식 event를 넣어주는 인텐트에는 Training phrases가 없다!!!



STEP2  action 에 say.bye를 넣는다. ( actions on google client library api1에서는 주로 이 action 이랑 fullfilment랑 연결해주었다.


actionMap을 통해서 하지만 api2 에서는 주로 인텐트 이름으로 연결한다. (git hub 예제들을 보면 링크 : https://github.com/actions-on-google)


STEP3 CANCEL 이벤트 자체는 마지막 대화라는 체크를 해주어야한다. 






STEP4. fullfilment 로 시행되는 코드








전체코드 

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
32
33
34
35
36
37
38
39
40
41
42
43
/**
 * Copyright 2016 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for t`he specific language governing permissions and
 * limitations under the License.
 */
 'use strict';
 
 
 const {
   dialogflow
  
 } = require('actions-on-google');
 const admin = require('firebase-admin');
 const functions = require('firebase-functions');
 
 /** Dialogflow Parameters {@link https://dialogflow.com/docs/actions-and-parameters#parameters} */
 
 
 
 
 
 admin.initializeApp();
 const db = admin.firestore();
 
 const app = dialogflow({debug: true});
 
 
 app.intent('say_bye', (conv) => {
   conv.close(`바이`);
 });
 
 exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);
 
cs



결과



공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG more
«   2025/05   »
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
글 보관함