Abstract
Introduction
Insomnia is one of the most common mental health problems, affecting about one in five adults.1,2 It is not only a standalone disorder but is also highly comorbid with depression, with changes in sleep patterns even predicting the long-term course of depression. 3 Therefore, finding effective and convenient ways to address insomnia and depression simultaneously has become an essential challenge in both clinical practice and public health. However, most existing digital interventions focus on a single disorder and lack solutions that can target both conditions simultaneously.
Cognitive Behavioral Therapy for Insomnia (CBT-I) is the first-line non-pharmacological treatment. Evidence shows that it has longer-lasting effects than medication, effectively improving sleep onset, sleep maintenance, and overall sleep quality,4,5 and is recommended in international clinical guidelines.6,7 Nevertheless, the dissemination of CBT-I is limited by the need for trained professionals, costs, and accessibility. With the development of digital health, chatbots have been increasingly applied in mental health care, offering education, symptom tracking, and even delivering CBT-based interventions. They have been shown to improve anxiety and depression. However, most existing products require downloading separate mobile applications, which increases the learning burden and reduces long-term user adherence.8–12
To address these limitations, this study developed a chatbot embedded in the LINE platform (a mobile communication app like WhatsApp but with more integrated features, widely used in Japan and Taiwan; see https://www.digitalmarketingforasia.com/line-most-popular-app-in-japan/). Unlike conventional mobile applications, it operates directly within a communication tool that patients already use in their daily lives, eliminating the need to learn a new system and thereby reducing barriers to use and improving acceptance. The system not only integrates core elements of CBT-I but is also specifically designed to address the comorbid symptoms of insomnia and depression. This design bridges the gap in existing chatbots that typically target a single disorder (insomnia or depression) but fail to address the frequent coexistence of depression among patients with insomnia.
Benefit and effectiveness of cognitive behavioral therapy for insomnia
Insomnia is one of the most common issues in psychiatric outpatient clinics. 1 According to Morin et al. (2021), among 22,330 adults, 17.4% may suffer from insomnia disorder, with 36.7% experiencing insomnia symptoms primarily characterized by difficulty initiating sleep, maintaining sleep, or early morning awakening. 2 According to the criteria in the Diagnostic and Statistical Manual of Mental Disorders, Fifth Edition, insomnia patients are often dissatisfied with their sleep quality or quantity, experiencing at least one primary symptom occurring at least 3 days per week and lasting for more than 3 months, impacting daily life. 3 Insomnia is common in various physical and mental illnesses, 13 it may persist; early changes in insomnia features can predict the outcomes of long-term depression. 14 Therefore, treatment of insomnia should be considered integral to comprehensive mental health care.1,15
Treatment methods for insomnia include pharmacotherapy; however, for many insomnia patients, anxiety, depression, or other medical conditions may be the primary causes, making simple sleep aids potentially ineffective. For secondary insomnia, identifying and treating specific underlying causes should be prioritized. If improvement is not achieved or if the insomnia is chronic, intermittent or low-dose medications or Cognitive Behavioral Therapy for Insomnia (CBT-I) can be considered.16,17 CBT-I is a leading non-pharmacological approach that targets specific causes of insomnia through understanding sleep mechanisms and adjusting sleep-related thoughts and behaviors, thereby improving sleep quality and reducing the occurrence of insomnia symptoms.6,7
CBT-I effectively improves insomnia symptoms.4,5 The Clinical Practice Guideline for the Psychological and Behavioral Treatment of Insomnia, published by the American Academy of Sleep Medicine (AASM), 18 strongly recommends that physicians use CBT-I to improve sleep habits and treat chronic insomnia. Meta-analyses conducted by Morin et al. (1994) and Murtagh and Greenwood (1995) found that CBT-I significantly improves insomnia, with stimulus control and sleep restriction showing the best outcomes. Although CBT-I does not provide the immediate relief that sleeping pills do, its long-term effects are superior, making it more effective than medication alone.18–20 Recent insomnia treatment guidelines almost universally recommend CBT-I as the first-line treatment. Studies have shown that the effect sizes for CBT-I in improving insomnia indicators—defined as 0.2 for low, 0.5 for medium, and 0.8 for high—can reach up to 0.98 for overall insomnia symptoms, with moderate to high effect sizes for sleep onset and maintenance. CBT-I is recommended as the first-line treatment over medication. 21
The feasibility and potential impact of chatbots in psychiatry
With advances in technology, the application of chatbots in healthcare treatment is increasingly widespread, particularly in addressing depression and insomnia.22–24 Depression, a chronic illness, requires early diagnosis. Traditionally, assessment of depression relies on questionnaire surveys. However, AI-powered medical chatbots predict depression symptoms by analyzing Discord chat messages, achieving at least 73% accuracy in predicting seven key symptoms through machine learning models. 25 DEPRA, an AI-based chatbot, is utilized for early detection of depression. 26
Chiu et al. (2024) indicated that the application of artificial intelligence and deep learning in mobile applications, particularly chatbots, can facilitate personalized mental health support. 27 These tools integrate early screening, assessment, psychological counseling, and cognitive behavioral therapy (CBT), effectively enhancing sleep quality and alleviating depressive symptoms. Through natural language processing, machine learning, and generative dialogue technologies, chatbots provide intelligent and autonomous interactions. Compared with traditional face-to-face therapy, they exhibit high feasibility and acceptability, low cost, and broad accessibility, representing an essential innovative strategy for promoting mental health and improving sleep.
These chatbots not only provide personalized recommendations based on user needs but can also identify mental health issues,26,28 track emotions,10,29 offer cognitive behavioral therapy (CBT),30–32 and promote positive psychology. Furthermore, CBT provided by chatbots offers a low-intensity and cost-effective option for treating depression and anxiety. A 4-week study showed significant improvements in depression and anxiety symptoms, demonstrating the effectiveness of the chatbot Tess in reducing users’ anxiety symptoms (Fulmer et al., 2018). However, the downside is that it requires an additional download, which may cause operational difficulties.
Intelligent chatbots have already been applied in clinical settings, such as depression28,33,34 and insomnia35–37, and have been shown to provide substantial benefits to patients. However, most insomnia-related digital interventions embed chatbots within standalone mobile applications that primarily provide basic Q&A functions,38,39 and often lack the richer interaction and dynamic engagement that more advanced conversational systems could potentially offer.8–12 Moreover, most of the existing products are standalone mobile applications, requiring users to download new standalone mobile applications and learn or understand these new systems, which might cause operational difficulties for patients, affecting the tools’ popularity and user satisfaction. Whether these tools can provide real-time assistance and educational functions still needs further verification. If they do not meet expectations, patients may lose trust, affecting their willingness to use them long-term. 39 Additionally, these chatbots only target insomnia or depression, but clinically, it has been found that many insomnia patients often suffer from depression. The chatbots developed in the past were not designed to address such conditions.
Objectives
Traditional hospital-based CBT-I typically involves at least five group sessions, each lasting 60–90 min, led by trained therapists. However, due to shortages of healthcare professionals, many institutions are unable to provide such treatment, and patients often rely on pharmacotherapy. To address this issue, this study integrates the core components of CBT-I into a LINE-based chatbot, enabling patients to learn sleep-related information independently. This approach reduces barriers to accessing CBT-I, enhances treatment accessibility and effectiveness, and mitigates the impact of limited healthcare resources, such as those caused by the COVID-19 pandemic or transportation difficulties. 40 Moreover, the system is specifically designed to address the high comorbidity of insomnia and depression, filling the gap left by most existing digital interventions that target only a single condition.
Methods
Study design
In this study, eligible participants were first screened by physicians at the collaborating hospital via review of medical and outpatient records and then formally recruited by the attending physicians. A total of 80 patients were randomly assigned to either the CBT Chatbot intervention group or the Sleep Education Website control group. The intervention group received a 4-week CBT-based chatbot program, while the control group received standard sleep education delivered via a static website. Providing the control group with standard educational materials Eligible patients had the study details thoroughly explained by clinical research assistants, and written informed consent was obtained. The study was conducted in strict accordance with Good Clinical Practice guidelines and the Declaration of Helsinki to ensure the rights and safety of all participants (Figure 1). Flowchart depicting the study methodology.
This study was approved by the hospital’s Institutional Review Board, and all personnel involved in screening and recruitment received research ethics certification from a recognized clinical trial education and training center.
Participants
From June 2023 to May 2024, we recruited patients from the psychiatric outpatient clinic who met the following criteria: (1) aged 20 years and above; (2) experiencing significant insomnia symptoms, including difficulty initiating sleep, sleep maintenance difficulties, or early morning awakening, occurring more than 3 days per week and persisting for more than 3 months, or using sleep medication more than 3 days per week for more than 3 months; (3) owning a personal mobile phone or mobile device with internet access.
Patients were excluded from the study if they met the following criteria: (1) lack of willingness to participate; (2) clinical physicians assessed them as having impaired capacity to understand questionnaire content or unable to sustain completion of assessments due to physical conditions; (3) comorbid with schizophrenia, bipolar disorder, or substance use disorder; (4) recent adjustment of treatment medications within the past month or anticipated adjustment during the study period; (5) received or planned to receive other forms of therapy within the past month or during the study period, such as psychotherapy, cranial electrical stimulation (CES), transcranial direct current stimulation (tDCS), repetitive transcranial magnetic stimulation (rTMS), or nutritional supplements aimed at improving mood or insomnia; (6) patients with suicidal ideation or behavior.
Randomization
The clinical research assistant conducted randomization during assessment visits, using a web browser on a tablet to access a randomization system. Participants were assigned to the control and intervention groups in a 1:1 ratio using simple randomization. This method was chosen because it is straightforward, ensures equal probability of allocation for each participant, and is appropriate for the sample size of this study.
Intervention
In this study, the intervention group received a 4-week chatbot-based intervention grounded in CBT, while the control group used a sleep education website developed by psychiatrists. The website covered an introduction to insomnia, its diagnosis and classification, common contributing factors, different types of sleep disorders and their differential diagnoses, as well as psychiatric conditions related to insomnia. In addition, the materials included core concepts of CBT for insomnia and various non-pharmacological treatment approaches, such as stimulus control, sleep restriction, cognitive therapy, relaxation exercises, sleep hygiene, and light exposure therapy. Before the start of the study, researchers reinforced health education during outpatient visits, reminding participants to read the website content at least once per week during the study period, with the option to browse freely. We developed this chatbot using the LINE Official Account Manager, as LINE is the most popular chatbot platform in Taiwan. Based on literature reviews and interviews, CBT offers a safer, more effective, and longer-lasting treatment option compared to medication.10,11,41–43 As a result, recent guidelines for treating insomnia almost universally recommend CBT-I as the first-line treatment. 21 Consequently, we developed a conceptual framework for a CBT-based chatbot and proposed the following seven management strategies: (1) Pre-sleep diary, (2) Post-sleep diary, (3) Mood tracking, (4) Sleep education articles, (5) CBT videos, (6) Response statistics charts, and (7) Stimulant and lifestyle tracking (e.g., coffee, alcohol, smoking). These components assist patients in identifying insomnia issues, improving their symptoms, and cultivating healthy sleep skills.
Bedtime diary and mood recording data
The CBT-based chatbot sends messages daily to all participants and collects their bedtime diaries. These track three main aspects: emotions, mental state, and pre-sleep relaxation - abdominal breathing videos. Figure 2 illustrates participants’ ratings of their emotional states, including excellent, good, neutral, low mood, and irritability. Mood tracking.
Wake-up journal and health education articles
In addition to the bedtime diary, participants also need to record the previous night’s bedtime, as well as the consumption of stimulant beverages and lifestyle factors such as coffee, alcohol, and smoking. Figure 3 displays participants’ records based on actual dietary and lifestyle habits, with the system pushing relevant health education articles based on these habits. Wake-up journal and health education articles.
Cognitive behavioral therapy video
After selecting the related videos, participants will be able to watch five cognitive-behavioral therapy (CBT) videos covering the following topics: dysfunctional belief management, sleep hygiene education, sleep restriction therapy, stimulus control therapy, and relaxation techniques. These videos provide practical CBT skills to help patients improve their sleep quality and overall health. Through dysfunctional belief management, patients can learn how to identify and change negative thoughts affecting sleep; sleep hygiene education offers suggestions to enhance sleep environment and habits; sleep restriction therapy and stimulus control therapy focus on managing sleep time and sleep environment, respectively; lastly, relaxation techniques provide simple and easy relaxation methods to help patients relieve stress and promote sleep. These videos will help patients practice CBT methods daily, improving their physical and mental health, as shown in Figure 4. Cognitive behavioral therapy video.
Sleep statistics charts
When participants’ response records exceed 7 days, the system will push a weekly report of their responses for reference, as shown in Figure 5. Users can also click ‘Response Record Statistics Charts in the graphic menu to view their response records for reflection and improvement. These features are designed to help participants better understand their sleep patterns effectively. Sleep statistics chart.
Measures
Before and after the study intervention, participants in both the experimental and control groups were required to complete the Pittsburgh Sleep Quality Index (PSQI), the Brief Symptom Rating Scale (BSRS-5), the Patient Health Questionnaire (PHQ-9), the Beck Depression Inventory (BDI), and the Beck Anxiety Inventory (BAI). All questionnaires were self-administered by the participants during their outpatient visits.
Pittsburgh sleep quality index (PSQI)
The PSQI consists of 10 self-rated questions assessing sleep quality, with the tenth question screening for ‘high-risk patients with breathing pauses,’ which is not scored. The remaining nine questions cover seven aspects: subjective sleep quality, sleep latency, sleep duration, habitual sleep efficiency, sleep disturbances, use of sleep medications, and daytime dysfunction. Scores range from 0 to 21, where a PSQI score greater than five indicates sleep quality disturbances, with higher scores indicating poorer sleep quality. 44
Brief symptom rating scale (BSRS-5)
The BSRS-5, the ‘Mood Thermometer,’ is a screening tool designed to assess mental health needs. It helps healthcare professionals understand the extent of a patient’s emotional distress and is widely used in suicide prevention work. This scale consists of five items, with the ‘suicidal ideation’ item assessed separately. A score of 6 or higher is used as the cutoff point for screening. Patients are asked to reflect on their level of distress or trouble over the past week, including the assessment day. A total BSRS-5 score of 3 or less can rule out suicide risk. It is recommended to first ask about the presence of symptoms and, if they exist, to determine their severity. 45
The patient health questionnaire (PHQ-9)
The PHQ-9 is a self-administered scale designed to measure the severity of a patient’s depression. It consists of nine questions that correspond to the diagnostic criteria for major depressive episodes as outlined in the DSM-5. Scoring instructions: A total score of less than 9 indicates no depression, 10–14 indicates mild depression, 15–19 indicates moderate depression, and 20 or higher indicates severe depression. 46
The beck depression inventory (BDI)
The BDI is used to assess depressive symptoms and their severity. This inventory consists of 21 sets of items, each with four options arranged according to the severity of the symptoms. Each option is scored from 0 to 3 based on the severity level. The content covers the diagnostic criteria for depressive symptoms and severity, as outlined in the DSM-IV. 47
The beck anxiety inventory (BAI)
The BAI measures the severity of anxiety through self-reporting. This inventory consists of 21 items that describe anxiety symptoms. Each item is rated on a scale from 0 to 3, with 0 indicating ‘not at all,’ 1 indicating ‘mildly,’ 2 indicating ‘moderately,’ and three indicating ‘severely.’ The total score is then used to interpret the severity of the respondent’s anxiety. 48
Results
Study participants
Baseline characteristics of participants.
aSome participants have been diagnosed with more than one disease.
bSome participants were diagnosed with more than one psychiatric illness.
Trial outcomes on insomnia, depression, and anxiety
Pre- and post-intervention comparison of mental health and sleep quality measures between intervention and control groups.
Note. PSQI: Pittsburgh Sleep Quality Index; BSRS-5: Brief Symptom Rating Scale; PHQ-9: Patient Health Questionnaire; BDI: Beck Depression Inventory; BAI: Beck Anxiety Inventory.
*p < .05 ***p < 0.001.
Discussion
Principal findings
Based on the research results, our study yielded two main findings, summarized as follows:
Improvement in sleep quality using a chatbot based on cognitive behavioral therapy
This study was conducted in a psychiatric outpatient clinic, where insomnia is commonly observed in patients with depression and anxiety. Even when antidepressant treatment is successful, insomnia may persist.1,49 Previous research has found that the treatment of insomnia should be considered an integral part of overall mental health care, as it not only enhances the quality of life for patients but also reduces the risk of depression relapse.36,49–52 CBT-I effectively improves insomnia symptoms, with its benefits enduring overtime and surpassing medication alone.14,15,17
The study results indicated that the intervention group experienced significant improvement in sleep quality after using the CBT-based chatbot. Specifically, according to the PSQI, the difference in pre-and post-test scores for the intervention group reached statistical significance (t (34) = 3.80, p < .001), demonstrating the chatbot’s significant effectiveness in improving participants’ sleep quality. In contrast, the control group showed no significant difference in PSQI scores between the pre-and post-tests (t (30) = −0.42, p = .075). These results highlight the potential effectiveness of chatbot-based CBT interventions in improving sleep quality.8,53 The results of this study showed that PSQI and other scales (BSRS-5, PHQ-9, BDI, and BAI) all demonstrated reductions. From a clinical perspective, although the degree of improvement measured solely by the PSQI was not substantial, the concurrent alleviation of depressive and anxiety symptoms suggests meaningful clinical significance. Improvements in sleep quality, accompanied by better emotional states and enhanced quality of life, can be highly beneficial for patients. In many cases of insomnia, emotional distress and sleep disturbance are mutually reinforcing severe insomnia worsens emotional problems, and vice versa, often leading to a vicious cycle. Therefore, improving insomnia usually helps to alleviate depression and anxiety. Given the limitations of pharmacological treatments, including safety concerns and the risk of dependence, psychological interventions such as cognitive behavioral therapy for insomnia are more desirable in clinical practice. However, access to comprehensive psychological treatment is often limited by barriers such as time, cost, transportation, or public health restrictions. Thus, an accessible, user-friendly, and side-effect–free approach may still hold clinical value. Even if the treatment effects are not dramatic, partial improvements in insomnia symptoms may help break the vicious cycle and further promote overall patient well-being.
Understanding sleep mechanisms and adjusting sleep-related thoughts and behaviors can help improve sleep quality and reduce insomnia symptoms. Research has shown CBT to be an effective intervention, with its core focus on helping individuals identify and change negative sleep-related thoughts and behavioral patterns.54–57 Therefore, the CBT-based chatbot has shown significant improvement effects, providing continuous interaction and support to help users better manage and improve their sleep issues.58–60
Enhancement of mental health through cognitive behavioral therapy-based chatbots
In addition to improved sleep quality, the intervention group showed significant improvements in several mental health assessment indicators. Specifically, they scored significantly better than the control group on BSRS-5, PHQ-9, BDI, and BAI. This suggests that the intervention had a substantial effect on improving the mental health status of the participants. The pre-post differences in the intervention group were significant on the BSRS-5 (t(34) = 2.43, p < .05), PHQ-9 (t(34) = 2.14, p < .05), BDI (t(34) = 3.73, p < .001), and BAI (t(34) = 2.31, p < .05), indicating a significant impact of the intervention across various mental health assessments.
In contrast, the control group showed no significant changes in pre-post scores across the same mental health assessment scales, suggesting that participants who did not receive the intervention did not experience notable improvements in their mental health status during the study period. The pre-post differences in the control group were not significant on the BSRS-5 (t(30) = 0.00, p = 1.00), PHQ-9 (t(30) = 0.87, p = 0.39), BDI (t(30) = 1.19, p = 0.24), and BAI (t(30) = 0.98, p = 0.33).
Overall, the findings confirm the effectiveness of CBT-based chatbots, which not only show concern for the participants but also engage in dialogue with them. Compared to traditional insomnia CBT groups, which typically require at least five face-to-face sessions lasting 60 to 90 min each, chatbots overcome common issues such as the awkwardness of face-to-face consultations, reluctance to disclose true feelings, the burden on healthcare personnel, and scheduling difficulties. By integrating CBT, these chatbots enhance treatment accessibility, allowing patients to engage in sleep training anytime and anywhere, thereby further improving therapeutic outcomes.12,16,31,61
Strengths and limitations
The study is based on a chatbot that utilizes CBT-I to improve insomnia symptoms and mental health conditions, demonstrating effects similar to traditional CBT-I treatment. This indicates that chatbots can effectively enhance sleep habits and treat chronic insomnia while overcoming the time and resource limitations associated with face-to-face consultations in traditional therapy. Patients can engage in training at any time, increasing the convenience and accessibility of treatment. This offers a new solution, especially for those who find it difficult to access in-person therapy.
However, this study has several limitations. First, the sample was drawn solely from the psychiatric outpatient clinic of a single medical center, which may have introduced referral bias and limited the generalizability of the findings. Second, the proportion of female participants was relatively high. Since sleep and mental health problems may differ by gender, this imbalance could affect the external validity of the results. Future studies should expand the sample size, include more male participants, and incorporate long-term follow-up to examine the stability of intervention effects across genders and over time. Third, due to funding constraints, this study implemented only a 4-week intervention without long-term follow-up. With additional resources, future research should extend the intervention period to evaluate its sustained effects more comprehensively. Finally, the control group was only exposed to a static web-based document containing basic sleep education, which lacked interactive functions and usage records, making it challenging to assess participant engagement accurately. Future studies should include platform click tracking and usage monitoring to evaluate engagement and ensure comparability of intervention effects more precisely.
Conclusion
Using a chatbot based on CBT-I to improve insomnia symptoms and psychological health is a promising approach. Although this technology has shown significant potential,43,62 further research is needed to validate its effectiveness. If subsequent studies confirm the efficacy of these interventions, the primary challenge will be how to implement them into the healthcare system and ensure reimbursement. The ongoing development, regular updates, and maintenance of the latest technology will also incur associated costs. Future research should explore ways to expand the functionality of chatbots and investigate their integration with traditional healthcare services. This will help establish a more comprehensive healthcare support system and provide personalized mental health assistance.
Footnotes
Acknowledgments
We sincerely appreciate the contributions of all participants and research personnel involved in this study. We also extend our gratitude to National Taipei University of Technology and Wan-Fang Hospital, Taipei Medical University for their academic collaboration and support. Special thanks to the Taipei Medical University-Joint Institutional Review Board (TMU-JIRB) for its review and guidance on this study.
Ethical considerations
This study was reviewed and approved by the Taipei Medical University-Joint Institutional Review Board (TMU-JIRB) (Approval No.: TMU-JIRB Form071/20200317).
Consent to participate
All participants received detailed study information and provided written informed consent before participating.
Author contributions
Yi-Hang Chiu: Participated in study design, responsible for data collection, drafted and revised the manuscript.
Yen-Fen Lee: Participated in study design, responsible for data collection and result analysis, drafted and revised the manuscript.
Huang-Li Lin: Participated in study design, responsible for clinical supervision and data interpretation, assisted in manuscript revision.
Li-Chen Cheng: Provided methodological guidance, responsible for result analysis, participated in manuscript writing and academic review.
All authors have read and approved the final manuscript and are responsible for the study findings.
Funding
The authors disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This study was funded by the “National Taipei University of Technology and Wan-Fang Hospital, Taipei Medical University Academic Collaboration Research Project” (Project Title: “CBT-I-Based Chatbot for Assisting Insomnia Treatment”), under Grant No. NTUT-WFTMU-112-04.
Declaration of conflicting interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Data Availability Statement
The data generated and analyzed in this study are used solely for research purposes and are kept confidential in accordance with ethical guidelines. Data requests may be directed to the corresponding author upon reasonable request.
Trial registration
This clinical trial was registered at https://ClinicalTrials.gov (Identifier: NCT07021625; URL:
).
