Messaging and voice APIs let a company's software send an SMS, a WhatsApp message, an email or a voice call to almost any phone number, with a few lines of code. The companies that sell them are called CPaaS companies, short for communications platform as a service. An API is a fixed format in which one program asks another program to do something. Here, the request is "send this message to this number".
Why do businesses buy this instead of building it? To reach a phone, a message must pass through that phone's mobile operator. Every operator has its own connections, rules and prices, and there are hundreds of operators around the world. The CPaaS company signs agreements with the operators once. It then sells access to all of them through one API.
Consider a developer at a medicine delivery start-up in Indore. She wants every customer to get an SMS when the order is packed. She writes about ten lines of code. The code sends the platform four things: the customer's number, the start-up's registered sender name, the text "Your order 58213 is packed and will reach you by 6 p.m." and the address of a page on the start-up's own server. Within a second, the platform replies with a message ID, a reference number for this one message. It then finds the operator for the customer's number. For an Indian number, it usually hands the SMS to an A2P SMS aggregator that has direct connections to Jio, Airtel, Vi and BSNL. A few seconds later, the operator reports that the message has reached the phone. The platform sends this delivery report to the page that the developer named. So the start-up knows which messages arrived and which did not. It pays the platform a small fee for each message.
Voice calls work the same way. The code can ask the platform to call a number and play a recorded message, or to connect two people. Calls travel as data, using VoIP (voice over IP), until they reach the operator's network. The same platforms connect calls for number masking, and for voice bots, software that answers phone calls by itself.
Many apps do not write their own login-code logic. They use the platform's OTP verification service instead. For WhatsApp, the platform passes messages to the WhatsApp Business API. Some platforms also resell network APIs, which let an app ask the operator questions, such as whether a SIM card was replaced recently.
A messaging API is different from notification infrastructure. The messaging API sends a message by the one channel that the developer chose. Notification infrastructure sits above it and chooses the channel for each message.