Our prize winning chatbot at the Token hackathon

Reading Time: 3 minutes

A few weeks ago, oneUp attended the Token hackathon where we won a prize with the creation of a Flight Delay Insurance Chatbot.

From June 3 till June 9 Token organized the Token hackathon; a contest to develop creative apps for the Token Browser. A total of $25k worth of ETH in prizes and a $25k Boost VC seed investment could be won for the best entries. Since we always love a challenge at OneUp and a chance to show off our skills, we decided to participate!

Token, now known as Toshi, is an open source mobile browser for the Ethereum blockchain. Its main goal is to provide universal access to financial services. With Token you can use decentralized applications (DApps), send messages and transfer money in the form of ether. Token is available on Android and iOS.

The way the bot chats

Our first step was to determine what project to focus on for the hackathon. We decided to work together with Etherisc, an insurtech startup from Germany. Etherisc’s vision is to build decentralized insurance through the use of DApps on the blockchain. Their first DApp, FlightDelay enables users to insure themselves against any possible flight delay, without an insurance company by sharing the risk between all the users of the DApp. For the Token hackathon, we wanted to build a chatbot interface on Token for the FlightDelay smart contract.

As excited as we were to go straight to programming, we needed to determine how the chatbot would respond based on the user inputs. We want the responses of the chatbot to give the user the feeling he or she is talking with a real person and not just a program. Christoph from Etherisc made a chat flow that showed the different responses from the chatbot for each step of the flight insurance process. After the initial friendly welcome message, the chatbot asks the user their flight details, specifically their origin, destination and the date of their flight. With the flight information obtained from the user, the chatbot will then show a list of relevant flights to the user. From this list of flights, the user selects their flight after which the chatbot asks for the desired premium the users wishes to pay for the insurance. Based on the premium the chatbot shows a table of payouts depending on the delay and asks the user to confirm the policy. Once the user confirms, the insurance application process is finished and the user is insured for the flight.

Protocol party

Next, it was finally time to program our FlightDelay chatbot! Token provides a JavaScript sample app which is easy to use as a starting point and expand upon. Bot logic can be implemented by responding to different types of messages such as a simple message, command or a payment request. Token uses the Simple Open Financial Protocol (SOFA) which is a JSON protocol that provides a standard set of UI components (buttons, attachments, images etc) which allows you to quickly build (financial) applications. Using the SOFA protocol you can specify whether the reply from the chatbot should contain plain text, image, video or buttons. As an example, when a user first sends a message to our chatbot, the bot would reply with a friendly welcome message and show the user two buttons: “apply for a policy” and “view my policies”. The starter app provides a persistence layer via Postgres (a database), enabling you to store data for each user the bot is chatting with. We used this session data to store which step the user is at in the policy application process.

Finally, after a week of intense programming, hair pulling and receiving excellent support from the Token team at their slack channel, our Flight Delay chatbot was finished in time for the hackathon deadline. The next day the winners were announced for the Token hackathon and we were happy to see that we won the prize for “Best mobile-friendly DApp UI”! We thoroughly enjoyed participating in the Token hackathon and want to thank the Token team for their support, and Etherisc for working together so well on this project. We look forward to improving the FlightDelay chatbot and we will be on the lookout for the next hackathon!