├── Trigger handler ├── README.md ├── Failure handler ├── Message handler └── Context handler /Trigger handler: -------------------------------------------------------------------------------- 1 | response = Map(); 2 | response.put("action","reply"); 3 | response.put("replies",{"Hey Peeps! I'm Dr. EduBot, Phd. in Assistance. Is there anything I can help you with?"}); 4 | response.put("suggestions",{"Courses Offered","Cutoff","Entrance Exams","Top Colleges"}); 5 | return response; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Eduera 2 | 3 | EDUERA is a bot designed to be placed on an educational website which helps the students to find the best college to pursue their career. Using this bot users can calculate their cutoff percentage and find the college and department which is suitable to their cutoff. The user can also view the list of courses offered by the colleges and details about the same. The ranking of top best colleges can be accessed. The various Entrance exams details are also available for the admission in colleges. Eduera surely suggest you with best college for your better future! 4 | -------------------------------------------------------------------------------- /Failure handler: -------------------------------------------------------------------------------- 1 | response = Map(); 2 | if(failed_response.get("action").equalsIgnoreCase("forward")) 3 | { 4 | code = cause.get("code").toNumber(); 5 | if(code == 1001) 6 | { 7 | // Outside business hours 8 | response.put("action","reply"); 9 | response.put("replies",{"It seems that this is off working hours for us","Leave us a message and we will get back to you"}); 10 | } 11 | else if(code == 1002) 12 | { 13 | // operators_not_available 14 | response.put("action","reply"); 15 | response.put("replies",{"All our agents are busy at the moment","Leave us a message and we will get back to you"}); 16 | } 17 | else if(code == 1003) 18 | { 19 | // invalid_operators - Operators may be disabled or invalid 20 | response.put("action","reply"); 21 | response.put("replies",{"All our agents are busy at the moment","Leave us a message and we will get back to you"}); 22 | } 23 | } 24 | return response; -------------------------------------------------------------------------------- /Message handler: -------------------------------------------------------------------------------- 1 | response = Map(); 2 | msg = message.get("text"); 3 | suggestions = {"Courses Offered","Cutoff","Entrance Exams","Top Colleges"}; 4 | if(operation.equals("chat")) 5 | { 6 | if(suggestions.indexOf(msg) == -1) 7 | { 8 | response.put("action","reply"); 9 | response.put("replies",{"Hey Peeps! I'm Dr. EduBot, Phd. in Assistance. Is there anything I can help you with?"}); 10 | response.put("suggestions",suggestions); 11 | return response; 12 | } 13 | } 14 | if(!msg.isNull()) 15 | { 16 | response.put("action","context"); 17 | if(msg.equalsIgnoreCase("Courses Offered")) 18 | { 19 | response.put("context_id","courses"); 20 | question = {"name":"course_type","replies":{"What are you looking for?"},"input":{"type":"select","options":{"With MATHS","Without MATHS"}}}; 21 | } 22 | else if(msg.equalsIgnoreCase("Entrance Exams")) 23 | { 24 | response.put("context_id","entrance"); 25 | question = {"name":"education_type","replies":{"You can know about the list of entrance exams"},"input":{"type":"select","options":{"Proceed"}}}; 26 | } 27 | else if(msg.equalsIgnoreCase("Cutoff")) 28 | { 29 | response.put("context_id","cutoff"); 30 | question = {"name":"select","replies":{"Do you want to calculate your cutoff?"},"input":{"type":"select","options":{"Yes","No"}}}; 31 | } 32 | else if(msg.equalsIgnoreCase("Top Colleges")) 33 | { 34 | response.put("context_id","Top Colleges"); 35 | question = {"name":"pro","replies":{"Ready to see top colleges.."},"input":{"type":"select","options":{"Proceed"}}}; 36 | } 37 | else 38 | { 39 | response.put("action","reply"); 40 | response.put("replies",{"Hey Peeps! I'm Dr. EduBot, Phd. in Assistance. Is there anything I can help you with?"}); 41 | response.put("suggestions",suggestions); 42 | return response; 43 | } 44 | response.put("questions",{question}); 45 | } 46 | return response; -------------------------------------------------------------------------------- /Context handler: -------------------------------------------------------------------------------- 1 | response = Map(); 2 | info answers; 3 | response.put("action","context"); 4 | response.put("context_id",context_id); 5 | response.put("context_id","cutoff"); 6 | if(context_id.equals("Top Colleges")) 7 | { 8 | if(!answers.containsKey("complete")) 9 | { 10 | queryValue = Map(); 11 | queryValue.put("start_index","1"); 12 | Sresponse = zoho.sheet.getRecords("3627n7821cca6629840b497e25b11a495c5ec","Sheet1",queryValue); 13 | //info Sresponse; 14 | L = {0,1,2,3,4,5,6,7,8,9}; 15 | ListC = {"Showing the Top 10 Colleges..."}; 16 | records = Sresponse.get("records"); 17 | info records; 18 | for each i in L 19 | { 20 | st = toString(i + 1) + "." + records.get(i).get("College name") + " - " + records.get(i).get("Location"); 21 | ListC.add(st); 22 | info records.get(i).get("College name"); 23 | } 24 | ListC.add("Want to proceed"); 25 | question = {"name":"complete","replies":ListC,"input":{"type":"select","options":{"Yes","No"}}}; 26 | response.put("questions",{question}); 27 | } 28 | else 29 | { 30 | complete = answers.get("complete").get("text"); 31 | if("No thanks".equals(complete)) 32 | { 33 | response.put("action","end"); 34 | response.put("replies",{"It was nice chatting with you 😊, Have a nice day !! Bye👋"}); 35 | } 36 | else 37 | { 38 | response.put("action","reply"); 39 | response.put("replies",{"What else do you want?"}); 40 | response.put("suggestions",{"Courses Offered","Cutoff","Entrance Exams","Top Colleges"}); 41 | return response; 42 | } 43 | } 44 | } 45 | if(context_id.equals("entrance")) 46 | { 47 | educationtype = answers.get("education_type").get("text"); 48 | if(educationtype.equals("Proceed")) 49 | { 50 | if(!answers.containsKey("detailsEnt")) 51 | { 52 | queryValue = Map(); 53 | queryValue.put("start_index","1"); 54 | Sresponse = zoho.sheet.getRecords("3627n7821cca6629840b497e25b11a495c5ec","Sheet3",queryValue); 55 | rec = Sresponse.get("records"); 56 | info rec; 57 | ListExam = List(); 58 | for each i in rec 59 | { 60 | ListExam.add(i.get("ENTRANCE EXAMS")); 61 | } 62 | question = {"name":"detailsEnt","replies":{"List of Entrance exams"},"suggestions":ListExam}; 63 | response.put("questions",{question}); 64 | } 65 | else 66 | { 67 | detailsEnt = answers.get("detailsEnt").get("text"); 68 | if(!answers.containsKey("complete")) 69 | { 70 | queryValue = Map(); 71 | valueC = "\"ENTRANCE EXAMS\"=\"" + detailsEnt + "\""; 72 | queryValue.put("criteria",valueC); 73 | queryValue.put("start_index","1"); 74 | response_get = zoho.sheet.getRecords("3627n7821cca6629840b497e25b11a495c5ec","Sheet3",queryValue); 75 | query = response_get.get("records").toCollection(); 76 | info query; 77 | Links = {"text":detailsEnt,"type":"links","links":{{"text":"Click to explore","url":query.get("WEBSITE LINK"),"target":"_blank"}}}; 78 | question = {"name":"complete","replies":{detailsEnt + " is conducted by " + query.get("CONDUCTING BODY"),Links},"suggestions":{"Want to continue","No thanks"}}; 79 | response.put("questions",{question}); 80 | } 81 | else 82 | { 83 | complete = answers.get("complete").get("text"); 84 | if("No thanks".equals(complete)) 85 | { 86 | response.put("action","end"); 87 | response.put("replies",{"It was nice chatting with you 😊, Have a nice day !! Bye👋"}); 88 | } 89 | else 90 | { 91 | response.put("action","reply"); 92 | response.put("replies",{"What else do you want?"}); 93 | response.put("suggestions",{"Courses Offered","Cutoff","Entrance Exams","Top Colleges"}); 94 | return response; 95 | } 96 | } 97 | } 98 | } 99 | } 100 | else if(context_id.equals("courses")) 101 | { 102 | course_type = answers.get("course_type").get("text"); 103 | if(!answers.containsKey("done")) 104 | { 105 | st = "COURSES LIST WITHOUT MATHS"; 106 | if(course_type.equals("With MATHS")) 107 | { 108 | st = "COURSES LIST"; 109 | } 110 | queryValue = Map(); 111 | queryValue.put("start_index","1"); 112 | Sresponse = zoho.sheet.getRecords("3627n7821cca6629840b497e25b11a495c5ec","Sheet2",queryValue); 113 | rec = Sresponse.get("records"); 114 | info rec; 115 | L = List(); 116 | for each i in rec 117 | { 118 | L.add(i.get(st)); 119 | } 120 | //info L; 121 | question = {"name":"done","replies":L,"input":{"type":"select","options":{"Main menu","No thanks"}}}; 122 | response.put("questions",{question}); 123 | } 124 | else 125 | { 126 | complete = answers.get("done").get("text"); 127 | if("No thanks".equals(complete)) 128 | { 129 | response.put("action","end"); 130 | response.put("replies",{"It was nice chatting with you 😊, Have a nice day !! Bye👋"}); 131 | } 132 | else 133 | { 134 | response.put("action","reply"); 135 | response.put("replies",{"What else do you want?"}); 136 | response.put("suggestions",{"Courses Offered","Cutoff","Entrance Exams","Top Colleges"}); 137 | return response; 138 | } 139 | } 140 | } 141 | else if(context_id.equals("cutoff")) 142 | { 143 | activity = answers.get("select").get("text"); 144 | if("Yes".equals(activity)) 145 | { 146 | if(!answers.containsKey("maths")) 147 | { 148 | question = {"name":"maths","replies":{"Enter your maths mark"}}; 149 | response.put("questions",{question}); 150 | } 151 | else 152 | { 153 | maths = toNumber(answers.get("maths").get("text")); 154 | if(!answers.containsKey("physics")) 155 | { 156 | question = {"name":"physics","replies":{"Enter your physics mark"}}; 157 | response.put("questions",{question}); 158 | } 159 | else 160 | { 161 | physics = toNumber(answers.get("physics").get("text")); 162 | if(!answers.containsKey("chemistry")) 163 | { 164 | question = {"name":"chemistry","replies":{"Enter your chemistry mark"}}; 165 | response.put("questions",{question}); 166 | } 167 | else 168 | { 169 | chemistry = toNumber(answers.get("chemistry").get("text")); 170 | cutoff = maths + chemistry / 2 + physics / 2; 171 | //responseSet = zoho.salesiq.visitorsession.set("Triomphante1",{"cutoff":cutoff},"salesiqconnection"); 172 | queryValue = Map(); 173 | valueC = "\"CSE Cutoff\"<\"" + cutoff + "\" or \"CSE Cutoff\"=\"" + cutoff + "\" or \"ECE Cutoff\"<\"" + cutoff + "\" or \"ECE Cutoff\"=\"" + cutoff + "\" or \"IT Cutoff\"<\"" + cutoff + "\""; 174 | queryValue.put("criteria",valueC); 175 | queryValue.put("start_index","1"); 176 | Sresponse = zoho.sheet.getRecords("3627n7821cca6629840b497e25b11a495c5ec","Sheet1",queryValue); 177 | info Sresponse; 178 | records = Sresponse.get("records"); 179 | collegeList = List(); 180 | //locList = List(); 181 | for each i in records 182 | { 183 | collegeList.add(i.get("College name")); 184 | } 185 | if(!answers.containsKey("selectCol")) 186 | { 187 | question = {"name":"selectCol","replies":{"Congrats! Your cutoff is " + cutoff + " .Colleges available for your cutoff.."},"suggestions":collegeList}; 188 | response.put("questions",{question}); 189 | } 190 | else 191 | { 192 | selectCol = answers.get("selectCol").get("text"); 193 | if(!answers.containsKey("done")) 194 | { 195 | queryValue = Map(); 196 | valueC = "\"College name\"=\"" + selectCol + "\""; 197 | queryValue.put("criteria",valueC); 198 | queryValue.put("start_index","1"); 199 | Sresponse = zoho.sheet.getRecords("3627n7821cca6629840b497e25b11a495c5ec","Sheet1",queryValue); 200 | rec = Sresponse.get("records").toCollection(); 201 | info rec; 202 | Image = rec.get("Image"); 203 | url = rec.get("Website"); 204 | info rec.get("Image"); 205 | question = {"name":"done","replies":{"",{"type":"links","text":selectCol,"image":Image,"links":{{"url":url,"text":"click to explore"}}}},"suggestions":{"See eligible department at " + selectCol,"No thanks"}}; 206 | response.put("questions",{question}); 207 | } 208 | else 209 | { 210 | done = answers.get("done").get("text"); 211 | done = done.subString(27); 212 | info done; 213 | if(!answers.containsKey("complete")) 214 | { 215 | info done; 216 | valueC = "\"College name\"=\"" + done + "\""; 217 | queryValue.put("criteria",valueC); 218 | queryValue.put("start_index","1"); 219 | Sresponse = zoho.sheet.getRecords("3627n7821cca6629840b497e25b11a495c5ec","Sheet1",queryValue); 220 | rec = Sresponse.get("records").toCollection(); 221 | info rec; 222 | location = rec.get("Location"); 223 | code = rec.get("College code"); 224 | link = rec.get("Website"); 225 | dept = {"College code : " + code,"Location : " + location,"Website : " + link,"Department available for your cutoff.."}; 226 | cutoffList = {"CSE : " + rec.get("CSE Cutoff"),"ECE : " + rec.get("ECE Cutoff"),"EEE : " + rec.get("EEE Cutoff")," IT : " + rec.get("IT Cutoff"),"CIVIL:" + rec.get("Civil Cutoff"),"MECH :" + rec.get("Mech Cutoff")}; 227 | for each i in cutoffList 228 | { 229 | j = i.subString(6); 230 | info j; 231 | if(toNumber(j) <= cutoff) 232 | { 233 | //dept.add((i.subString(0,5)).replaceAll(":","")); 234 | dept.add(i); 235 | } 236 | } 237 | question = {"name":"complete","replies":dept,"suggestions":{"Want to continue","No thanks"}}; 238 | response.put("questions",{question}); 239 | } 240 | else 241 | { 242 | complete = answers.get("complete").get("text"); 243 | if("No thanks".equals(complete)) 244 | { 245 | response.put("action","end"); 246 | response.put("replies",{"It was nice chatting with you 😊, Have a nice day !! Bye👋"}); 247 | } 248 | else 249 | { 250 | response.put("action","reply"); 251 | response.put("replies",{"What else do you want?"}); 252 | response.put("suggestions",{"Courses Offered","Cutoff","Entrance Exams","Top Colleges"}); 253 | return response; 254 | } 255 | } 256 | } 257 | } 258 | } 259 | } 260 | } 261 | } 262 | else 263 | { 264 | if(!answers.containsKey("cutoff")) 265 | { 266 | question = {"name":"cutoff","replies":{"Give me your cutoff"}}; 267 | response.put("questions",{question}); 268 | } 269 | else 270 | { 271 | cutoff = toNumber(answers.get("cutoff").get("text")); 272 | queryValue = Map(); 273 | valueC = "\"CSE Cutoff\"<\"" + cutoff + "\" or \"CSE Cutoff\"=\"" + cutoff + "\" or \"ECE Cutoff\"<\"" + cutoff + "\" or \"ECE Cutoff\"=\"" + cutoff + "\" or \"IT Cutoff\"<\"" + cutoff + "\""; 274 | queryValue.put("criteria",valueC); 275 | queryValue.put("start_index","1"); 276 | Sresponse = zoho.sheet.getRecords("3627n7821cca6629840b497e25b11a495c5ec","Sheet1",queryValue); 277 | info Sresponse; 278 | records = Sresponse.get("records"); 279 | collegeList = List(); 280 | for each i in records 281 | { 282 | collegeList.add(i.get("College name")); 283 | } 284 | if(!answers.containsKey("selectCol")) 285 | { 286 | question = {"name":"selectCol","replies":{"Congrats! Your cutoff is " + cutoff + " .Colleges available for your cutoff.."},"suggestions":collegeList}; 287 | response.put("questions",{question}); 288 | } 289 | else 290 | { 291 | selectCol = answers.get("selectCol").get("text"); 292 | if(!answers.containsKey("done")) 293 | { 294 | queryValue = Map(); 295 | valueC = "\"College name\"=\"" + selectCol + "\""; 296 | queryValue.put("criteria",valueC); 297 | queryValue.put("start_index","1"); 298 | Sresponse = zoho.sheet.getRecords("3627n7821cca6629840b497e25b11a495c5ec","Sheet1",queryValue); 299 | rec = Sresponse.get("records").toCollection(); 300 | info rec; 301 | Image = rec.get("Image"); 302 | url = rec.get("Website"); 303 | info rec.get("Image"); 304 | question = {"name":"done","replies":{"",{"type":"links","text":selectCol,"image":Image,"links":{{"url":url,"text":"click to explore"}}}},"suggestions":{"See eligible department at " + selectCol,"No thanks"}}; 305 | response.put("questions",{question}); 306 | } 307 | else 308 | { 309 | done = answers.get("done").get("text"); 310 | done = done.subString(27); 311 | info done; 312 | if(!answers.containsKey("complete")) 313 | { 314 | info done; 315 | valueC = "\"College name\"=\"" + done + "\""; 316 | queryValue.put("criteria",valueC); 317 | queryValue.put("start_index","1"); 318 | Sresponse = zoho.sheet.getRecords("3627n7821cca6629840b497e25b11a495c5ec","Sheet1",queryValue); 319 | rec = Sresponse.get("records").toCollection(); 320 | info rec; 321 | location = rec.get("Location"); 322 | code = rec.get("College code"); 323 | link = rec.get("Website"); 324 | dept = {"College code : " + code,"Location : " + location,"Website : " + link,"Department available for your cutoff.."}; 325 | cutoffList = {"CSE : " + rec.get("CSE Cutoff"),"ECE : " + rec.get("ECE Cutoff"),"EEE : " + rec.get("EEE Cutoff")," IT : " + rec.get("IT Cutoff"),"CIVIL:" + rec.get("Civil Cutoff"),"MECH :" + rec.get("Mech Cutoff")}; 326 | for each i in cutoffList 327 | { 328 | j = i.subString(6); 329 | info j; 330 | if(toNumber(j) <= cutoff) 331 | { 332 | //dept.add((i.subString(0,5)).replaceAll(":","")); 333 | dept.add(i); 334 | } 335 | } 336 | question = {"name":"complete","replies":dept,"suggestions":{"Want to continue","No thanks"}}; 337 | response.put("questions",{question}); 338 | } 339 | else 340 | { 341 | complete = answers.get("complete").get("text"); 342 | if("No thanks".equals(complete)) 343 | { 344 | response.put("action","end"); 345 | response.put("replies",{"It was nice chatting with you 😊, Have a nice day !! Bye👋"}); 346 | } 347 | else 348 | { 349 | response.put("action","reply"); 350 | response.put("replies",{"What else do you want?"}); 351 | response.put("suggestions",{"Courses Offered","Cutoff","Entrance Exams","Top Colleges"}); 352 | return response; 353 | } 354 | } 355 | } 356 | } 357 | } 358 | } 359 | } 360 | return response; --------------------------------------------------------------------------------