Consumer debt, credit card debt, and personal loan debt are at all-time highs. Meanwhile, investors who purchase debt for cents on the dollar and then try to collect the whole amount, and the collection agencies they hire, are getting increasingly aggressive. One in four consumers contacted by debt collectors feels threatened, and most consumers say the calls persist even after requests to stop, according to a 2017 study by the Consumer Financial Protection Bureau.

To borrowers who owe money, it’s a living nightmare. To Ohad Samet, cofounder and CEO of TrueAccord, a San Francisco debt-collection startup that has raised nearly $30 million, it’s a software problem.

“We believe that we can use technology to radically change the user experience and really help people with their day-to-day finances,” he says.

Instead of robocalls that go unanswered, letters lost in a pile of mail, and pushy collection agents who work on commission, TrueAccord contacts people through email, text, and the occasional Facebook ad, nudging them to check their inbox for an email from TrueAccord. Customers can adjust repayment plans online, changing the amount week to week or canceling a payment with no fee.

The company uses machine learning to analyze data collected from behavior on its website and other information shared voluntarily. TrueAccord says it does not buy any personal, financial, or demographic data, including credit scores, does not use affinity data, and does not “creep crawl the web.” But it does know how much a debtor owes, to whom, and how far behind the person is on the payments. Over time, the company believes, this data will help it predict preferences, like whether customers prefer text versus email, days and times to send messages, and even tone of voice, such as empathetic, friendly, or inspirational, but never aggressive.

TrueAccord is part of a wave of tech startups that claim they can increase the amount collected on debts and help consumers at the same time by using technology to personalize the process. Y Combinator’s demo day in August featured a pitch from the incubator’s second debt-collection startup, Prodigal Technologies, which says its software can make it easy for borrowers to explain their financial situation by uploading unemployment or insurance forms. Y Combinator, which is simultaneously developing a large-scale basic-income study, also backed a medical-debt company called Collectly, which has raised nearly $2 million. The companies tout flexible repayment plans, but lenders restrict what they can offer. Prodigal’s CEO Shantanu Gangal says his company works with a lender’s risk, compliance, and operations team to generate options modeled on the lender’s past data. “To the extent possible, we will come up with another borrower-friendly alternative,” Gangal says.

China has also seen a burst of debt-collection startups, including Ziyitong, which uses artificial intelligence to scrape the internet for information on borrowers and their friends, and Yigou, which provides collection agents with geolocation data on some borrowers.

In comparison, the American variety sounds more like ecommerce and less like surveillance, which is part of their pitch. Treat debtors more like online customers early in the process and you can save them from less-friendly players down the line.

Venture capitalist Hunter Walk, who invested in TrueAccord in 2013, said his firm, Homebrew, was drawn to the idea of keeping debt out of the “hands of increasingly aggressive, shady, and sketchy collection agents.” He said the firm first mulled whether it wanted to wade into debt collection, drawing a comparison to ecigarette companies. “Even if vaping is healthier than cigarettes, I'm not sure I'd want to be in the tobacco business, PERIOD,” Walk said via email. “But our research and conversations with Ohad suggested that TrueAccord wasn't simply a ‘less evil’ product but one that at scale could help consumers settle their debts, improve their credit, and remove stress created by their previous financial decisions.”