I am trying to combine two conditions in fulfilment.
basically, I want the type of admission and the department condition to be met before my chat bot replies based on the input.
problem is in the ADMISSION_ENQUIRY intent code
here is the code I tried:
const {dialogflow} = require('actions-on-google')
const WELCOME_INTENT = 'Default Welcome Intent'
const FALLBACK_INTENT = 'Default Fallback Intent'
const ADMISSION_ENQUIRY = 'admission_enquiry_intent'
const DEPARTMENT_ENTITY = "Department"
const ADMISSION = "Admission_Type"
const app = dialogflow()
app.intent(WELCOME_INTENT, (conv) => {
conv.ask('Hi, this chatbot was created to answer any question you may have about The Federal University of Technology Owerri')
})
app.intent(FALLBACK_INTENT, (conv) => {
conv.ask("I didn't understand your request")
})
app.intent(ADMISSION_ENQUIRY, (conv) => {
const department_type = conv.parameters[DEPARTMENT_ENTITY].toLowerCase();
const admission_type = conv.parameters[ADMISSION].toLowerCase();
if (department_type == "mathematics" && admission_type == "UTME") {
conv.ask("MATHEMATICS is a department under the SCHOOL OF PHYSICAL SCIENCES. To get admitted into the department, it is required that you have At least five O’ Level Credit passes in English Language, Mathematics, Chemistry, Physics and any other science subject, in not more than two sittings. At least a Pass Is required in Biology. The JAMB course combination for the department is; English Language, Mathematics, Chemistry and Physics.")
}
else if (department_type == "chemistry" && admission_type == "UTME") {
conv.ask("CHEMISTRY is a department under the SCHOOL OF PHYSICAL SCIENCES. To get admitted into the department, it is required that you have At least five O’ Level Credit passes in English Language, Mathematics, Chemistry, Physics and any other science subject, in not more than two sittings. At least a Pass Is required in Biology. The JAMB course combination for the department is; English Language, Mathematics, Chemistry and Physics.")
}
else{
conv.ask("thank you for asking that but we have not coded the answer yet")
}
})
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app)```