BackgroundOver the last two decades, deaths associated with opioids have escalated in number and geographic spread, impacting more and more individuals, families, and communities. Reflecting on the shifting nature of the opioid overdose crisis, Dasgupta, Beletsky, and Ciccarone offer a triphasic framework to explain that opioid overdose deaths (OODs) shifted from prescription opioids for pain (beginning in 2000), to heroin (2010 to 2015), and then to synthetic opioids (beginning in 2013). Given the rapidly shifting nature of OODs, timelier surveillance data are critical to inform strategies that combat the opioid crisis. Using easily accessible and near real-time social media data to improve public health surveillance efforts related to the opioid crisis is a promising area of research.ObjectiveThis study explored the potential of using Twitter data to monitor the opioid epidemic. Specifically, this study investigated the extent to which the content of opioid-related tweets corresponds with the triphasic nature of the opioid crisis and correlates with OODs in North Carolina between 2009 and 2017.MethodsOpioid-related Twitter posts were obtained using Crimson Hexagon, and were classified as relating to prescription opioids, heroin, and synthetic opioids using natural language processing. This process resulted in a corpus of 100,777 posts consisting of tweets, retweets, mentions, and replies. Using a random sample of 10,000 posts from the corpus, we identified opioid-related terms by analyzing word frequency for each year. OODs were obtained from the Multiple Cause of Death database from the Centers for Disease Control and Prevention Wide-ranging Online Data for Epidemiologic Research (CDC WONDER). Least squares regression and Granger tests compared patterns of opioid-related posts with OODs.ResultsThe pattern of tweets related to prescription opioids, heroin, and synthetic opioids resembled the triphasic nature of OODs. For prescription opioids, tweet counts and OODs were statistically unrelated. Tweets mentioning heroin and synthetic opioids were significantly associated with heroin OODs and synthetic OODs in the same year (P=.01 and P<.001, respectively), as well as in the following year (P=.03 and P=.01, respectively). Moreover, heroin tweets in a given year predicted heroin deaths better than lagged heroin OODs alone (P=.03).ConclusionsFindings support using Twitter data as a timely indicator of opioid overdose mortality, especially for heroin.