app script doPost รับข้อมูลจาก diaglogflow
function doPost(e) { var data = JSON.parse(e.postData.contents); var intentName = data.queryResult.intent.displayName; if (intentName === 'prodrug_inten') { var productName = data.queryResult.parameters.product_entity; var price = lookupPrice(productName); var response = createResponse(productName, price); return ContentService.createTextOutput(JSON.stringify(response)).setMimeType(ContentService.MimeType.JSON); } else { return ContentService.createTextOutput(JSON.stringify({ fulfillmentText: "ขออภัย ไม่สามารถประมวลผลคำขอนี้ได้" })).setMimeType(ContentService.MimeType.JSON); } } function lookupPrice(productName) { // สมมติว่าเราใช้ Google Sheets เป็นฐานข้อมูล var sheet = SpreadsheetApp.openById('1SFuy-_AAXFeDYxlWAGA-4Ls9pMWe4apWSfe2X3eQkfA').getSheetByName('productinfo'); var data = sheet.getDataRange().getValues();...