Building Little Window: how we created a chatbot for Chayn
Written by Johanna Herman
Little Window — one of the first chatbot and AI innovations at the intersection of gender-based violence and tech for good — has recently gone live on Chayn’s website: chayn.co. Hera, the founder of Chayn, has written a great article on why Chayn wanted to create a chatbot, and as the team of developers behind Little Window, we also wanted to contribute our insights from the process.
We started Little Window for our final charity client project at Founders & Coders, a non-profit organisation that runs free web development bootcamps. While we were thinking of project ideas, an ex-student, Rory McElearney, came to give us a presentation about his work at the AI and machine learning consultancy, Filament AI. He offered mentorship to any team who wished to learn how to make a chatbot with a sponsorship from Filament. While we were excited and keen to take him up on this generous offer, we also wanted to find a charity that would really benefit from the technology.
Johanna got in touch with Chayn because she knew of their work through Twitter, and wanted to contribute to their survivor-led web resources. She initially thought that one of their toolkits might be suitable for turning into a chatbot. However, serendipitously, it turned out that Hera already had a concept note written for Little Window! She had a plan for a chatbot that would provide key information online for those experiencing domestic abuse in a way that is easy to find, simple to navigate and quick to interact with. By directing those affected by domestic abuse to the information they are looking for as quickly as possible, she hoped to cut down 40% of search time for most users, as many don’t have large windows of opportunity to access help and others might get discouraged from unfruitful searches.
It has been just under 3 months since Johanna first contacted Chayn, and since then, the team has designed, built and deployed the chatbot. It has been a great collaborative process, and we really benefited from the nature of Chayn’s organisational structure and volunteer staff. Hera was able to respond extremely quickly to our initial enquiry and we were able to get going within two weeks. It is unlikely that this fast turnaround would have been possible with a more traditional charity. The Chayn team is used to working remotely and this also really facilitated our design and build sprints, since it meant we were able to communicate with Hera through Google Hangouts and WhatsApp, and have scripts reviewed by Chayn volunteers using Google Docs. The speed at which the team was able to plan, build and deploy Little Window is a testament to Chayn’s commitment to innovation and progressive way of working.
Both Chayn and the Founders & Coders team has learnt a great deal, and the code is available as open source with the hope that other tech for good organisations will explore chatbot technology too. These are some of our key learnings:
Designing in a sensitive way
We spent a great deal of time planning the conversation flow and making sure this was designed sensitively and appropriately. Advising people facing abuse on how to seek safety is a big responsibility and we wanted the accuracy of our scripts to reflect this. For example, at the beginning of the conversation, if the chatbot does not understand the question that is asked by the user, we present the available options straight away (for the moment only domestic abuse, divorce and asylum). We felt that giving the user options to choose immediately was more supportive, rather than risk further frustration due to continued misunderstandings. In addition, Little Window is upfront about being a chatbot (also it’s a cat). Unlike customer service chatbots, which may try to pass themselves off as real people, Little Window is there only to provide resources, and is clear about this purpose.
There was a lot of discussion around the wording regarding consent for saving a conversation.The ability to save messages to a database provides important information on frequency of questions, location, cultural identity and feedback regarding areas of improvement, and issues that should be covered. Analysing this data would then enable Chayn to identify areas for future topics, improve the performance of Little Window and provide inputs to the organisation’s future projects and resources. Although we never ask for any personal or identifying information, it is important that users are informed about the data collection. It was a difficult balance to get this message across without slowing down their first interaction with the chatbot, and the added possibility of losing a user.
Users of the Chayn website often identify with multiple countries, which is an important part of the Chayn ethos and was very important to Hera. Due to the complexity of this feature, the function was implemented in the second sprint, and as a result, users are able to choose as many countries as they wish and receive information for all of these in turn. Alternatively, if their country is not listed, they can let Little Window know so that the Chayn team can assess where the demand is coming from.
It is quite easy to get a Facebook messenger or a Slack chatbot up and running through a framework such as Botkit or Botpress. However, Hera was clear from the beginning that she wanted the chatbot permanently on the website. The Chayn website receives a number of enquiries through email and we hoped that Little Window would be able to assist these users towards an immediate response. Having a standalone chatbot is a bit more challenging and although there are a number of available frameworks, we decided not to use any of them, both for learning purposes and functional reasons.
We decided to build the front-end on our own in React, which allowed us to have full control over styling, such as the presentation of option buttons and resource links. The back-end is built on an Express server in Node, which uses the DialogFlow API to manage the conversation responses. We use the Google Sheets API to fetch the relevant resources to be served to the user, allowing the Chayn team easy access to resource updates. All the chat logs are stored in a PostgreSQL database.
Natural Language Processing & Training
We are using DialogFlow to analyse questions asked by a user, which will then identify the correct intent, and respond according to our conversation flow. At the moment, there are a number of set questions that will trigger responses in the divorce, asylum or domestic abuse routes, with the relevant resource links then displayed for the user. As more people use Little Window, DialogFlow will get better at learning what sort of question goes to which route. The Chayn team will be able to go into DialogFlow and train the chatbot to understand how to respond better. They can look at past conversations and see how Little Window answered questions posed by users. If Little Window misdirected or misunderstood, this can be corrected and it will know what similar wording means in the future.
There is also an emergency intent, triggered when a user’s question contains a key word that signifies that they may be currently be in danger or at risk of harm. This aims to let users know that Little Window cannot help with immediate assistance and has a limited role. The message states, “I’m just a bot that tries to give you the most useful resources. If you are in imminent danger or this is an emergency, please contact the police or someone you trust.” At the moment, Dialog Flow is likely to trigger the emergency intent more often than needed and will need to be trained on this.
Rory reminded us that this is the least helpful Little Window will be and when it will make the most mistakes. So in the first few months, every failure helps Little Window get smarter.
We did some in-person and online user testing, including with survivors of domestic abuse, which was really useful. Our main change from this was that the speed of the messages needed to be slowed down, particularly where links were being shown to the user. Other inputs concerning tone and wording can be refined over time, and continually assessed according to user feedback.
What happens now? Now that Little Window is live, we will get a lot more feedback to inform further iterations for the chatbot. We will expand the topics to include Housing and Finance, as well as consolidate the current resources on other topics. There are a few bugs to be fixed, such as the mobile view on Safari, further browser compatibility testing and a need to offer different languages other than English. Much like the ability to choose multiple countries, this is a core function to ensure Little Window is fully accessible to those visiting the Chayn website.
Although their usage is increasing, chatbots are mainly used by organisations for commercial purposes. We are really pleased to have had this opportunity to work with Chayn, and to explore together how to use and modify the conventions of this technology to create something that is useful with a very different motivation.
We would love to hear from anyone with comments or suggestions!
All the Little Window team are on Twitter