Cloud-based communications software provider Twilio (TWLO -1.59%) has seen its stock battered badly in 2022. Shares have lost more than 71% of their value as investors haven't bought into the company's impressive growth. Rising interest rates and fears of a recession that could curtail spending on its offerings hampered its momentum.

A similar story unfolded at smaller competitor Bandwidth (BAND -3.63%), whose shares have dropped more than 80% so far this year. Bandwidth's drop isn't surprising as the company's bottom-line performance let investors down in 2022. Twilio, meanwhile, projected a much bigger loss than what analysts were looking for in the current quarter.

So, with both cloud stocks trading down big time this year, should investors interested in making a cloud play consider buying the lesser-known Bandwidth, based on its relatively attractive valuation, over Twilio?

Bandwidth is cheaper than Twilio, but for a reason

The brutal sell-off in both stocks means that they are available at relatively attractive valuations, but Bandwidth is the cheaper of the two.

Bandwidth trades at just 0.64 times sales compared to Twilio's price-to-sales (P/S) ratio of 3.85. And Bandwidth's forward earnings multiple of 43 is much lower than Twilio's rich multiple of 454. Of course, Twilio's richer valuation could be justified by its faster pace of growth.

The company's second-quarter revenue expanded 41% year over year to $943 million, driven by an increase in its customer base and higher spending by customers. Twilio's active customer base was up nearly 15% year over year to 275,000 last quarter.

A dollar-based net expansion rate of 123% means that the company was able to drive stronger customer spending. A reading of more than 100% in the dollar-based net expansion rate means that Twilio's active customers increased their usage of the company's offerings and/or adopted new products.

Bandwidth reported a much smaller year-over-year revenue increase of 12% in the most recent quarter to $136 million. The company's active customer count was up 9% year over year to 3,362, while its dollar-based net expansion rate stood at 112%.

Twilio looks like the more attractive growth play out of the two. Analysts expect the company's revenue to increase by 36% in 2022. On the other hand, Bandwidth's full-year revenue outlook of $554 million would translate into an increase of just 13% over last year. Therefore, growth-oriented investors may be attracted to Twilio following its sharp decline this year, but Bandwidth could turn out to be the better bet for those who are value-conscious.

Why Bandwidth may not be a bad bet after all

While Twilio may be the bigger of the two cloud specialists and is growing at a faster pace, Bandwidth is the profitable one. Bandwidth expects to finish 2022 with adjusted earnings of $0.12 per share, which would be a big decline from its 2021 earnings of $0.97 per share.

Twilio is expected to slip deeper into the red. Its adjusted loss per share is anticipated to balloon to $0.58 per share in 2022 from $0.25 per share in 2021. Twilio is expected to turn in a non-GAAP profit of $0.21 per share next year, but Bandwidth's bottom line could nearly quadruple in 2023 to $0.47 per share, according to consensus estimates.

So investors looking for a mix of both value and growth may find Bandwidth to be the better choice. The company's lower valuation is another advantage as richly valued stocks fell out of favor in 2022, and further interest rate hikes by the Federal Reserve could spell more trouble for the likes of Twilio.

Investors looking to buy a cloud stock at a reasonable valuation and with the potential for robust long-term growth could consider Bandwidth, especially since its bottom line is expected to grow at an annual pace of 20% for the next five years.