Twilio (TWLO 1.47%) investors have endured a tough time over the past year. Shares of the cloud communications specialist have dropped 29%, while the S&P 500 index has gained 4%. But now might be a good time to take advantage of the drop and buy this stock.

That's because Twilio is rapidly improving its bottom line, as its second-quarter 2023 results (which were released on Aug. 8) indicate. And more importantly, Twilio sees artificial intelligence (AI) as a big growth driver for its business that could help push its top-line growth into a higher gear. Let's look at Twilio's latest quarterly numbers and see how AI is likely to supercharge the stock in the long run.

Twilio's focus on efficiency is driving solid earnings growth

Twilio's second-quarter revenue increased 10% year-over-year to $1.04 billion. However, the company's non-GAAP earnings increased at a much faster pace and jumped nearly five-fold to $0.54 per share. Analysts were expecting Twilio to report $0.29 per share in earnings on $986 million in revenue, but the robust demand for the company's offerings and its focus on lowering its cost structure helped it beat Wall Street's expectations.

Twilio has reduced its workforce by nearly 29% since September 2022, and it has also lowered stock-based compensation. More importantly, Twilio has raised its full-year profit outlook. It expects non-GAAP operating income to land between $350 million and $400 million this year, up from the prior forecast of $350 million.

Analysts expect Twilio to sustain strong bottom-line growth over the next three years, which would be a big improvement compared to last year's loss of $0.15 per share.

TWLO EPS Estimates for Current Fiscal Year Chart

TWLO EPS Estimates for Current Fiscal Year data by YCharts

However, bears may argue that Twilio's earnings growth is mostly a result of its cost-cutting initiatives, as its revenue growth has been anemic of late and the company's guidance indicates that the trend is here to stay. Twilio expects its top line to remain flat year-over-year in the current quarter at $985 million, missing the consensus estimate of $1.02 billion. For the full year, analysts are expecting the company's revenue to increase by just 7% to $4 billion.

But then the growing adoption of AI in the cloud communications market is likely to open a whole new opportunity for Twilio, as management pointed out on the latest earnings conference call.

AI could give Twilio's revenue growth a shot in the arm

Twilio management mentioned the term "AI" 35 times on the earnings call, emphasizing that the technology is going to be a key growth driver for the company. That's not surprising, as the adoption of generative AI is expected to grow rapidly in the communications platform-as-a-service (CPaaS) market in which Twilio operates.

According to one estimate, the global CPaaS market could clock annual growth of almost 30% through 2027. The market's rapid growth is likely to be driven by the increasing adoption of generative AI applications such as chatbots, which can analyze customer data and help organizations improve their customer service levels.

This explains why Twilio is busy integrating "predictive and generative AI capabilities across our platform and every customer touch point." The company believes that training large language models using Twilio's large amount of first-party data can help its customers "enter the AI race multiple steps ahead of their peers."

The company is also partnering with Alphabet's Google to integrate generative AI into the Twilio Flex customer engagement platform, which allows companies to connect with their customers using various channels. But it is worth noting that this is one of many steps that Twilio is taking to bring generative AI to customers. The company plans to "showcase several of the products that will advance our customer AI vision" later this month, suggesting that it is looking to push the envelope to make the most of the AI opportunity within the CPaaS market.

As such, it wouldn't be surprising to see an uptick in Twilio's revenue growth following this year's muted performance given the company's foray into fast-growing niches such as AI.

TWLO Revenue Estimates for Current Fiscal Year Chart

TWLO Revenue Estimates for Current Fiscal Year data by YCharts

As the chart above indicates, Twilio's top line could jump to $5.3 billion at the end of 2025. Multiplying that by Twilio's five-year price-to-sales (P/S) ratio of 15.7 could translate into a market cap of $83 billion within the next three years. That would be more than seven times Twilio's current market cap.

Of course, the assumed sales multiple is well above the company's current P/S ratio of almost 3. Assuming Twilio carries a similar multiple after three years, its market cap could increase to almost $16 billion. That would represent a 43% upside from current levels. All this indicates that Twilio could turn out to be a top pick in the long run, especially considering the company's focus on boosting profitability and the potential impact of AI on its growth.