WeightMentor: A New Automated Chatbot for Weight Loss Maintenance

Obesity and Overweight are significant risk factors for many chronic conditions, such as type 2 diabetes. Weight loss is difficult and maintaining weight loss is a greater challenge. Effective communication is hindered by conflicting information and the sensitivity of the subject of obesity. Recent technological solutions for weight loss maintenance are limited. A chatbot would be appropriate for supporting weight loss as it does not require a human operator, is available 24 hours a day, and supports natural communication while maintaining anonymity. Such a system may also be integrated with popular social media platforms such as Facebook Messenger. This paper describes the design and development of the WeightMentor chatbot, a self-help motivational tool for weight loss maintenance. Chatbots may have the potential to contribute to obesity prevention and management.


INTRODUCTION
Obesity and overweight are recognised globally as risk factors for non-communicable diseases such as type 2 diabetes (World Health Organisation (WHO), 2018) and there are significant numbers of obese and overweight people worldwide.Even 10% weight loss will improve health (National Health Service (NHS), 2018) but is difficult to achieve and to maintain.
Misleading diet information and reluctance of health professionals to discuss what is seen as a sensitive subject lead to further difficulties (Moorhead et al. 2013).
Email, text messaging and internet-based systems have been trialled for supporting weight loss maintenance (Cussler et al., 2008, de Niet et al., 2012, Donaldson et al., 2014, Fjeldsoe et al., 2016, Svetkey et al., 2008, Thomas et al., 2011, Wing et al., 2006) and have enjoyed some degree of success, but are not without limitations.Text messages, for example, may only be read and responded to when a human operator is available to do so.Automated messages risk becoming too generic and thus less effective (Donaldson et al., 2014).This paper describes the design and development of WeightMentor, a self-help motivational chatbot for weight loss maintenance.

WHY A CHATBOT?
Chatbots simulate human conversation and fulfil a variety of roles, from customer service to virtual doctors, but the basic functionality is always the same.User goals of interacting with a chatbot can be short term, e.g.booking a restaurant, or long term, e.g.managing one's mental health.It has been reported that 2016 was the "rise of the chatbots" (Wharton University, 2016) and Google Amazon and Microsoft are already supporting voice enabled technologies and services with Cortana, Alexa, and Google Allo.These systems provide a conversational interface which permits more natural and intuitive interactions with the operator.A chatbot for weight loss maintenance could solve the problem of human operator availability, provide 24/7 access and allow natural communication while maintaining relative anonymity.In 2016, US technology firm Personetics identified the growing problem of "app fatigue", growing frustration with the vast number of smartphone apps available, most of which are downloaded, used once, and then discarded (Personetics, 2016).Social media apps rank as most popular, and it would make sense to integrate a chatbot with these tools.Facebook Messenger already supports chatbot development and existing users will not need to learn a new app with an unfamiliar interface.Chatbot usability is high due to their simple user interfaces, which are now moving back towards the early text-based style, although artificial intelligence (AI) and natural language processing make contemporary chatbot user interfaces considerably smarter than their textbased predecessors.Figure 1 shows how a typical chatbot conversation might look.
Users interact with WeightMentor through Facebook Messenger, whether on a PC, laptop, or mobile device.User messages are passed to the Facebook Messenger-enabled app via a webhook.Received messages are either handled using a backend app (written in NodeJS and hosted on Heroku) or passed to a Dialogflow agent.Dialogflow (formerly API.AI) is a conversational AI engine that facilitates easy handling of user conversations.It provides a powerful, if basic, framework for chatbot development and may be extended through the use of the Dialogflow API, which is compatible with major platforms such as NodeJS, Python, and Java.Samuel Holmes, Anne Moorhead, Raymond Bond, Huiru Zheng, Vivien Coates, Mike McTear Ulster University holmes-w@ulster.ac.ukDialogflow agents are made up of several components, summarised in Table 1.Anything the user says (training phrases) is assigned to an intent, which maps what the user has said to a specific action to be taken.Intents may also be triggered by events, which come from sources other than the user, such as external APIs.
Intents can be assigned contexts, which specify the context of the conversation, and may be combined with parameters for storing information requested from the user.Contexts and parameters are accessible to the app backend, as are actions, which can be used to trigger other behaviours such as generating a specific response, sending an email, or saving data to a database.

Handling User Interactions
Simple interactions may be natively within Dialogflow.However, collecting user information, displaying graphics or playing videos are beyond the scope of DialogFlow and require handling by the backend app.
During user profile creation, WeightMentor asks the user to enter things like their "preferred name" (i.e.what they want the chatbot to call them), gender and age (expressed as a range, rather than a number).This information is stored in parameters which may be accessed via the app backend and written to the database.Responses to the user may be achieved either by triggering a specific intent (which must be predefined within the agent) or by sending a message directly from the app backend (using the Facebook Messenger API).

Data Storage
Contexts have a limited lifespan -five requests or ten minutes.This is akin to short term memory in human cognition, or random-access memory in computing.
The lifespan can be increased if necessary, but it is not possible to permanently store the information contained within contexts.WeightMentor uses a Postgresql database for longterm storage of data, akin to long term memory in human cognition, or a hard drive in computing.Database query results are returned as an array of objects with each object representing a row from the database.
Data within these objects may be extracted and used, for example to plot a graph of the user's last five self-reported physical activity data, or to display a custom greeting or motivational message.

Development Challenges and Potential Solutions
Some of the challenges of developing WeightMentor will be discussed below.

Persistence of user data
User data is stored in a database.It is not practical or convenient to read from the database on every interaction, so profile information is read once and stored in a user data object.When a webhook event is triggered, the user object is checked to see if it is populated.If it is blank (undefined in NodeJS), the user data is read from the database and stored in the user data object, before the webhook event is handled as normal.

User experience design of a chatbot UX and UI design are constrained by Human
Computer Interaction design best practices, such as Ben Shneiderman's eight golden rules (Shneiderman et al., 2016), which state that a welldesigned system should be consistent, enable shortcuts, provide informative feedback, yield closure for all actions, handle errors, permit reversal of actions, reduce short term memory load and allow the user to feel that they are in control.These rules may not easily be applied to conversation-based systems, such as WeightMentor, where any graphical interface is merely a text entry field, send button, and chat window.Conversational user interfaces are designed to effectively replicate human conversational interactions.Simplistic conversations are the easiest solution, however human conversation is complex, and interactions with the system should reflect this.Conversational Analysis studies have identified three basic principles of conversation that should be considered during conversational UI design (Moore et al., 2017).Recipient Design tailors conversation to be acceptable and understandable to the recipient.Minimisation aids understanding by making conversation as efficient as possible using the smallest number of words possible.If understanding fails, mechanisms such as paraphrasing or repetition are used to repair the conversation and attempt to help the listener understand.
User interactions may be modelled on one of four main conversation types (Moore et al., 2017).Ordinary conversation is casual and not constrained and may cover topics ranging from small talk or catching up on gossip, to asking for help or advice.Service conversation is more formal, for interacting with customer service agents, sales people etc.This type of conversation features two distinct roles (requesting service and providing service) and predefined conversation paths, such as greeting the other person, introductions and identification, and requests for information.
Teaching conversation happens between a tutor or teacher and a student.Questions may be asked of the student to test knowledge and encourage the student to think about the correct answers.Interruption and correction, important aspects of all conversations, are particularly important here.
Counselling conversation occurs when one person seeks advice from another (such as a counsellor or technical advisor).The counsellor in this type of conversation allows the counselee to lead the conversation and there may be long periods where only one person is speaking.
WeightMentor uses a mixture of ordinary conversation (in a social context) and counselling conversation.
The social elements of the conversation use "smalltalk", a built-in Dialogflow agent that provides customisable responses to small talk (such as "Hi, how are you?").Counselling aspects use a database of pre-defined knowledge that may be generated at appropriate times.
As has previously been discussed, any user interface should be self-explanatory and intuitive.To accomplish this, the chatbot should lead the conversation, asking the user what they want to do next after every interaction and offering choices.This prevents the user being left in "limbo", unsure what to do next.

Unpredictability and variability of chatbot responses
Personalised messages are more likely to be read and reacted to than generic messages (Fry & Neff 2009, Smith et al., 2014, Stephens et al., 2014).Variability, changing the wording of prompts and responses for each interaction, is an important factor.Facebook is dependent on variabilityrepeatedly being shown the same content becomes a little tedious and boring after a time.WeightMentor will vary its responses to the user, from greetings to motivational responses.When the chatbot needs to send a response, all relevant responses will be read from a database table and one sent to the user at random.Context awareness can also be used to vary the user experience.If the user speaks to the chatbot on a Friday morning the bot might say "Hi there, aren't you glad it's the weekend?" 2.2.4.Allowing the user to select their "preferred name" WeightMentor will initially greet the user by the name on their Facebook profile.However, some users may prefer to use a different name, and WeightMentor will allow the user to do this, offering them a choice between the name from their Facebook profile or allowing them to enter a different name.WeightMentor stores their preferred name in the database, and always uses it when addressing the user.

CONCLUSIONS
Chatbots are emerging as the new face of human computer interaction and given the limited research into the use of technology for weight loss maintenance, may take these types of technologies in a new direction.This project will solve the problems of variability, personalisation and automation associated with traditional forms of motivational message and also that described by Moorhead et al, 2013, of reluctance of health professionals to discuss obesity and weight loss with their patients.This chatbot is valuable as it is evidence based and has the potential to contribute to the area of obesity management.Obesity and weight loss are still sensitive subjects, discussion topics avoided by many people.WeightMentor will not be influenced by human emotions, feel "embarrassed" to be talking openly about weight loss or worry about damaging its reputation.This creates the freedom to be as open and honest with the users as is required to get the message across and tell the user what they need to hear.The use of contemporary technologies for conversational AI development makes it an innovative system that can be feasibility tested for weight loss maintenance.

FUTURE WORK
WeightMentor will be tested for usability and any identified significant improvements will be implemented.Feasibility will be assessed in a live environment using participants who are actively maintaining weight loss.
Future improvements to the bot could potentially include the following: Integration with other health/fitness tools (e.g.FitBit); (ii) Voice recognition and speech capabilities; (iii) Sharing data with health practitioners.

Table 1 :
DialogFlow Agent Components Anything the user says.May be assigned to a specific intent, which is triggered when the training phrase is recognised.