in ts/src/util/es-client.ts [65:96]
async detectIntentSimpleEvent(
eventName: string,
sessionID: string,
platform?: keyof typeof google.cloud.dialogflow.v2.Intent.Message.Platform,
payload?: JsonObject,
languageCode: string = this.defaultLanguageCode
) {
const sessionPath = this.getSessionPath(sessionID);
const request: google.cloud.dialogflow.v2.IDetectIntentRequest & {
queryParams: object;
} = {
session: sessionPath,
queryParams: {},
queryInput: {
event: {
name: eventName,
languageCode,
},
},
};
if (payload) {
request.queryParams.payload = jsonToStruct(payload);
}
const [response] = await this.client.detectIntent(request);
const responses = response.queryResult?.fulfillmentMessages;
if (platform && responses) {
return this.filterReponses(responses, platform);
} else {
return responses;
}
}