 We're at a chatbot's meetup, and I'm pretty sure that most of you here are Builders of the art like people who want to build new things. So I Built bus uncle. How many of you here has heard of bus uncle? Okay, quite a fair bit of you so Because we're all builders I wanted to Direct this presentation in the form of the making of bus uncle so that I hope you guys could get a Better idea of like what you can use to build your own bot So an introduction to myself I'm an SMU graduate Currently a software engineer at Trey Gecko Trey Gecko is one of the most talented Companies startups in Singapore. I've learned so much from all my colleagues a Few things about me is I live on music. I love playing the drums and the guitar, and I love animations as well So yeah, that's a little introduction about me so how it all started was Back in October 2016. I was at a bus stop and at this bus stop I saw a lot of people over there just standing and looking to the right and waiting for their bus So all these guys really had like nothing to do. They're all just standing and waiting and Some of them are on their phones and their apps just waiting for their bus But basically you can see in generally most people just keep turning their heads right and wonder where their bus is They have all these questions I've been waiting all day. I need to shop so The thing is when you're waiting for your bus You would like to know how long you'd have to wait for your bus So that gives you a better idea and makes you feel better About having to stand there a little longer if you didn't know if if you had to wait for example 20 plus minutes And you didn't know you actually had to wait 20 minutes. You could have told yourself later Hey, actually, I could have just gone got a cup of coffee and come back now wasted my time So you want to know how long you want to your boss will arrive So Singapore has developed all these information boards everywhere that do help people Know how long it takes to find their bus But one problem here is there's too much information It shows you the waiting times for every bus it shows you the waiting time for the next bus as well and This board even refreshes after almost like every 5-10 seconds. It's just way too much information So apps also have tried to solve this problem apps there's some apps out there that not have these user interfaces where They show you a list of all buses at your bus stop or they show you like a list of all bus stops around you on a map and What I noticed about these apps When I was standing there was even these apps have too much information You have to do a fair bit of scrolling to actually find your bus You have to go to a search bar and type where you are Or even if you click on the map icon You you won't exactly know which bus you're at right then you'll be shown a list of bus stops around there Then you'll have to click something. There's a fair bit of thinking and a fair bit of acting involved here But the thing is I didn't actually want to do all that. I just wanted to know seven minutes so imagine you're just standing there at the bus stop and You just ask someone how long will my bus arrive someone tells you seven minutes. That's it. That's all you need to know So then I thought this was a perfect opportunity to build something that could answer a question I have I could ask something a question and it could give me an answer. I realized That I could build bus uncle So if you guys have haven't tried out bus uncle, please visit this link m.me slash sg bus uncle on your phones right now and you can give a and you can go try out try talking to the app so Basically to give you an idea of what bus uncle does is You can start a conversation by saying hello, then bus uncle will be like ah and Then you can ask bus how long bus uncle will ask where are you? You give your location. You can say you were at maple tree and bus uncle automatically knows that okay That's a location and he'll show you a list of all bus stops over there You just had to choose which bus stop you're at When you're after you've chosen your bus stop you he'll show you all the buses that go there Then you just choose your bus and as soon as you Choose your bus you'll tell you something like 10 minutes go get groceries so This is actually one of the longer ways of speaking with bus uncle Now you can actually chat with bus uncle and tell him the bus you're at the bus stop You're at all of it in one message and he'll give you the one answer that you want to know so that's basically bus uncle and Let's see How to build a bot so normally when you think about building a bot you think about oh you have to learn machine learning You have to master your linguistics. You have to know like How people speak all the different kinds of languages they speak and you have to practice all your algorithms right yet Because it's a very complex subject Not many people have done it before so it's so much so it's a lot. It's a lot more complex than it looks but actually it's not When you build a chatbot, you don't have to do any of this yourself because there's a lot of services out there That actually help you do all these things for you so There's a lot of different ways to build a chatbot, but In my opinion the three main parts to it The first part is you need some kind of machine learning library or machine learning platform So the more common ones out there are with dot AI and API dot AI These are websites that actually help you parse The language you speak to a bot into actionable objects So basically when you're a coder it allows you to read natural language and output Pieces of data that you can use in the different parts of your app machine learning platform is required The second platform you'd need would be a messaging platform. So The most common ones out there right now with support bots is Facebook messenger slack telegram There's some others also line kick, but these are just some examples. You have to choose one platform And finally you need a web server. So every bot in the background is actually just a web server Look the three examples here are heroku AWS Amazon web services and Microsoft Azure So you just have to choose one and that's it. That's all you need to build a chatbot You need to have a messaging platform a web server and a machine learning library So basically whenever anyone talks to your chat, but it goes through this process the user talks to the messaging platform goes to it hits the web server and the web server talks to hits machine learning and It all comes back all the way back to the user with a proper response for the user So bus uncle was built this way The platform I chose for bus uncle was Facebook messenger The web server I chose was heroku as well. It was on the free plan as well and the machine learning platform I used was wit.ai and My heroku web server was based on Node.js with Express So the thing is because bus uncle actually gets you real-time data and I had a web server I could use the web server to talk to LTA LTA provides an API to give you like bus arrival timing data So yeah, this was what bus uncle looked like in day one But this was when I released it in October 20th, October 26th, 2016 And as soon as I released it on my Facebook profile The number of users grew very slowly Firstly, it was just my friends who started talking to the bot And then they started sharing it with their friends They started liking the post and it started getting shared more and more and more So the number of users grew about maybe 20 to 40 per day for the first three or four days Then on the fifth day it got featured on mothership.sg. So mothership.sg actually had like covered bus uncle without even contacting me And on the day that mothership.sg had featured bus uncle Bus uncle's page had gone from 200 likes to 8,000 likes in four hours So this meant that all these users were actually trying to talk to bus uncle and On that day, I remember getting 50 to 60 people speaking to bus uncle in the same second That was horrible Because I was on the free plan. I could it just had it just kept crashing So it kept crashing and my colleagues are here. They saw me struggling Like with bus uncle servers that were crashing and when it was crashing I didn't want like the users to feel like they couldn't talk to bus uncle anymore So I had to just keep going to my Heroku web console and click the restart button Every ten minutes I'd go back to the Heroku web console and click restart restart So I knew I couldn't do this I knew I couldn't keep hitting restart forever So eventually I had to build a more complicated architecture for bus uncle From day one until day 30. It was a really fun adventure for me to actually Learn about the different things I could do with the architecture of a chatbot and on day 30 bus uncle looked something like this So I don't I wouldn't actually explain the whole thing to you but What I did mainly here was I introduced database instances. So bus uncle Started was connected to Redis Redis is a in-memory database and it was also connected to mongo And Redis was used to store user conversations It was stored is used to store context of conversations and the mongo was used to cache bus arrival timings cache bus stops and things like that And also I started I Start tracking users a lot more. This is very important Heroku web server will start speaking to Facebook analytics Facebook analytics is actually something that Facebook had introduced for their bots very recently as well maybe two or three months ago and basically what I did with Facebook analytics was almost every thing the users spoke to bus uncle or Almost every flow that went through in bus uncle. I tracked it Like I had to know how many users were doing one thing as opposed to something else. I had to know how many users were Getting errors as as opposed to actually being able to fulfill the their conversation So I started connecting to Facebook analytics Google Maps I added new features like Street View of bus stops So bus uncle is connected a lot more and even on my Heroku web server Because I started getting a lot more requests now I Couldn't use JavaScript the way JavaScript normally works. So I there's I had to do a lot of load balancing and a lot of parallel processing and I really thank async.js the library that it really helped me do that and Because now I had a lot more users to take care of I had a lot more users that I had to make sure I Had to keep satisfied I wanted to ensure like I wrote quality software. So I had to bring some kind of testing framework into my bot There's no proper Bot testing framework out there just yet. So I had to code my own I did it with mocha chai and Sinon and I also did some application performance tracking with New Relic and paper trail so to give you an idea or to give you my opinion of why it went viral was because Mainly bus uncle has a very strong personality So most chatbots you see out there Don't really have personality. I realized when I was building bus uncle what that I'm actually building someone you're talking to That means I'm actually kind of building a human being in the background So I didn't want this human being to just say something like okay next. What would you like next? Okay, cool. I wanted this person to actually like Be someone interesting someone who tell you jokes Someone who would like curse at you So so bus I had to give us uncle strong personality because it just felt right Another thing is it's a non-linear conversational flow. I recently read an article. It's there's another word for this It's called a random access navigation This means when whenever users speak to a chatbot Um, normally you think they have to go from Point a in a conversation to point B in a conversation So they have to start with one input the bot will ask them. Okay. I got a now What would you like B or C user clicks B? Okay? I got B now already likes a D or E. That's a very linear flow But bus uncle on the other hand is random access navigation. That means he won't ask you which Bus you're at he won't ask you. I mean, he won't ask you which bus you want you He'll ask you your the location you're at but you can also just give him the bus that you're looking for You can also send him the postal code you can send him your location through the Facebook messenger location Button and you can start a conversation any way you want and he will understand and he will guide He will guide you into giving you all into getting all the other inputs in other ways so that's a non-linear conversation flow and finally why the final point is bus uncle gives you answers you have questions and You know, you can't answer them without like opening up an app or going to a website He gives you the answers you want to know So that's my opinion of white one viral So currently the statistics of bus uncle are there are sixteen point eight thousand unique users The page has are almost 22,000 so I'm not sure where the what the others other users are doing So far has processed about 1.8 million messages For after it's been launched for about three and a half months and the average number of messages per users a hundred and seven That means users are really engaged with bus uncle. They just keep talking and talking and talking to bus uncle So this is a little chart of the number of messages From bus uncle. So when I released it in October on the first day, it was five messages That was probably like me my mother and and my friends I'm one thing 257,000 and Mid-January is about 1.4 million. So it just kept kept going up So that's some statistics and a lot of people ask me about what's the business potential here? so I've been thinking of different ways I could monetize this One way I'm doing it is by referral advertisements So if you guys had used bus uncle recently, maybe Last two two weeks ago. You notice that bus uncle start speaking for BBC some reason so bus uncle actually Doled users check wait check out for these I mean check out these BBC buses some buses where the BBC player splattered on top of the buses and you should go download BBC So that's one way of advertising. I was helping advertisers other things I'm currently Doing right now is content partnerships and transport partnerships So these are still in the process of being made But basically double add to the business as well So One thing about bus uncle is that bus uncle is and will always be a product People ask me. Oh, you've made bus uncle. Are you gonna make bus auntie now or are you gonna make MRT auntie now? So They asked me they basically asked me are you just gonna be building a lot of other other products Are you just are you gonna be? a kind of a consultant to build all these different bots for other people then I sat down and thought about it and I thought Maybe but what really excited me is the potential of what bus uncle has and I feel that bus uncle Won't change from a product. It's he's just gonna be a product Yeah, so that's the end of my presentation. That's something that bus uncle always says Well, once you say thank you to bus uncle. So please like my page here On facebook.com slash sd bus uncle or you can also add me on LinkedIn here or my Facebook Yep, thank you Sure But So in the start oh when you use with that AI you're taking to you're taken through with that AI's way of Creating a machine learning model. So how with that AI does it is they ask you to make a story and in a story you specify something a user might say and you have to specify What the user's intention was with what they were trying to say and They also allow you to highlight keywords in and what the user said so you can specify these keywords as entities So if you're more into bots, you've noticed that you've noticed the words Intense and entities being used in almost every bot platform Basically to train bus uncle I had to give it a few stories in the start So the first everything I trained bus uncle with was a bus how long So I trained bus uncle to understand that bus how long has the intent of finding bus time so I had to link it to my code to go to a function called find bus time and Some people might also ask like bus 65 at bus stop 0 4 1 2 1 how long I also had to highlight 65 and highlight 0 4 1 2 1 and say this is the bus this the bus stop Those were entities So in the start I had I specified maybe Five to ten different ways of how a user might talk to a bot and that that was actually like good enough in the start But now I have to keep continually training it at random intervals Yeah, any more questions The gentleman in gray you never introduced yourself Till we came and I'm a student at NUS Okay, any other questions