Twilio (TWLO -1.97%) investors have had a forgettable year so far. Shares of the cloud communications specialist lost 21% of their value in 2024, but the good part is that the recent stock price action points toward a turnaround in its fortunes.

The stock has gained 9% in the past couple of months, and its second-quarter 2024 results gave investors a reason to cheer. Let's see what has been working in Twilio's favor of late, and take a look at the possible reasons why this tech stock may be able to deliver more upside in the long run.

Twilio's improving customer base could help reignite its growth

Twilio reported Q2 revenue growth of 4% from the year-ago period to $1.08 billion, with organic year-over-year revenue growth coming in at 7%. The top line exceeded Twilio's original guidance range of $1.05 billion to $1.06 billion.

The company's non-GAAP earnings shot up to $0.87 per share from $0.54 per share in the same quarter last year, thanks to its focus on reducing its costs. Twilio was originally expecting its bottom line to land between $0.64 per share to $0.68 per share. So, the big earnings beat was enough to send Twilio stock up by almost 12% after it released its earnings on Aug. 1.

There were some other positive takeaways as well for investors. Twilio reported 316,000 active customer accounts at the end of the previous quarter, up from 304,000 in the same period last year. Additionally, the company witnessed a slight improvement in customer spending, as its dollar-based net expansion rate came in at 102% last quarter.

This metric compares the spending by Twilio's customers in a particular quarter to the spending by those same customers in the same period last year. An improvement in the dollar-based net expansion rate means that the company is getting more money out of its existing customer base. The year-over-year growth in the dollar-based net expansion rate may not be eye-popping, but investors should note that the company may be able to drive stronger customer spending in the future, thanks to the adoption of artificial intelligence (AI) in the customer service space.

Twilio's cloud communications platform allows companies to reach their customers through various channels such as voice, text, video, email, and others. Twilio management pointed out on the recent earnings conference call that its products integrated with AI are now witnessing traction among customers. As pointed out by CEO Khozema Z. Shipchandler:

In the quarter, we started to see success with our newer higher-margin software products. These are products that leverage AI such as Verify and Voice Intelligence, as well as platform innovations that natively embed AI and machine learning, such as traffic optimization engine and engagement suite to drive greater deliverability and better customer engagement.

The company expects these products to move the needle in a bigger way in the long run. That won't be surprising, as the adoption of AI in the customer service market is expected to grow at an annual rate of 24% through 2033, generating $3.2 billion in revenue at the end of the forecast period. Meanwhile, the size of the communication platform-as-a-service (CPaaS) in which Twilio operates is expected to grow from $15 billion in 2023 to $119 billion in 2031.

All this indicates that Twilio's growth could accelerate with time, especially considering that it has built a solid customer base and stands to gain from the adoption of new technologies such as AI in its industry.

Healthy earnings growth could help the stock deliver solid gains

Analysts have been raising their earnings growth expectations from Twilio of late.

TWLO EPS Estimates for Current Fiscal Year Chart

TWLO EPS Estimates for Current Fiscal Year data by YCharts.

The good part is that Twilio is expected to maintain an annual earnings growth rate of almost 20% over the next five years. Based on its 2023 earnings figure of $2.45 per share, its bottom line could increase to $6.09 per share in 2028. Twilio currently has a forward price-to-earnings ratio of 19, which is a discount to the U.S. technology sector's average earnings multiple of 44.

Assuming it continues to trade at this attractive valuation after five years and manages to deliver $6.09 per share in earnings, its stock price could jump to $116 per share. That would be a 95% jump from current levels. So, there is a good chance of Twilio being able to sustain its recent rally over the long run. That's why investors looking to buy a growth stock trading at a cheap valuation may want to buy it before it jumps higher.