kno

gupshup chatbot + todolist link

_ by Kyle Marino and Kolby Pham _

Note: The chatbot's news viewing capabilities aren't available in a normal browser window, but work perfectly fine in GupShup's IDE's emulator.

The main challenge in development was trying to work around GupShup's shortcomings in external integration; sometimes, parsing/interaction would work in the IDE but not externally, and sometimes vice versa.

It runs off of an index.php, so it requires a local server to run if off of local files. Online, it can be run at: http://gupshup-kylemarino22164237.codeanyapp.com/

We find the design to be pretty intuitive. More on the chatbot will be shown in demo.

Built With

Share this project:

Updates

posted an update

Code within the GupShup IDE for the chatbot:

function MessageHandler(context, event) { if(event.message.toLowerCase() == "hi"){ context.sendResponse("Hello."); } else if(event.message.toLowerCase() == "hello"){ context.sendResponse("Hello."); } else if(event.message.toLowerCase() == "help"){ context.sendResponse("Enter 'random', 'weather', 'politics', 'science', 'sports', entertainment', or 'tech' for corresponding news.") } else if(event.message.toLowerCase() == "weather"){ context.simplehttp.makeGet("http://gupshup-kylemarino22164237.codeanyapp.com/weather.php") } else if(event.message.toLowerCase() == "random"){ context.simplehttp.makeGet("http://gupshup-kylemarino22164237.codeanyapp.com/random.php") } else if(event.message.toLowerCase() == "politics"){ context.simplehttp.makeGet("http://gupshup-kylemarino22164237.codeanyapp.com/politics.php") } else if(event.message.toLowerCase() == "science"){ context.simplehttp.makeGet("http://gupshup-kylemarino22164237.codeanyapp.com/science.php") } else if(event.message.toLowerCase() == "sports"){ context.simplehttp.makeGet("http://gupshup-kylemarino22164237.codeanyapp.com/sports.php") } else if(event.message.toLowerCase() == "entertainment"){ context.simplehttp.makeGet("http://gupshup-kylemarino22164237.codeanyapp.com/entertainment.php") } else if(event.message.toLowerCase() == "tech"){ context.simplehttp.makeGet("http://gupshup-kylemarino22164237.codeanyapp.com/tech.php"); } else { context.sendResponse("I don't understand. Type 'help' for a list of supported commands."); }
}

//newsfetcher function HttpResponseHandler(context, event) { var content = JSON.parse(event.getresp); context.console.log(content); context.sendResponse("Your info: " + content) }

function EventHandler(context, event) { if(! context.simpledb.botleveldata.numinstance) context.simpledb.botleveldata.numinstance = 0; numinstances = parseInt(context.simpledb.botleveldata.numinstance) + 1; context.simpledb.botleveldata.numinstance = numinstances; context.console.log(numinstances); }

Log in or sign up for Devpost to join the conversation.