Let’s get straight to the point and turn you into a real Open API developer by breaking down the core concepts of how a Network API actually works.
First, let’s clarify what an Open API is and how it differs from a standard API.
"The main difference is that an Open API is publicly available, whereas a regular API might be restricted to specific users or partners" by Gemini
What this means is that as long as you keep your API publicly available—including documentation and specifications—you can call yourself an Open API developer.
For a Proof of Concept (PoC), this sounds like a lot of fun. But whenever a new trend or technology emerges, there’s always an opportunity to make it profitable.
In this lab, I will show you how to interact with Vonage Network API for FREE
Index
Scope:
I will show you how to interact with Vonage SMS API and Number Verification API, one of the insert complexity here
use cases from Communication and Network API catalogue.
State of Art:
Vonage CPaaS (Communications Platform as a Service) is a cloud-based platform that provides various real-time communication features, including voice, messaging, and video. Instead of building a communication infrastructure from scratch—which requires significant time, resources, and maintenance—businesses can integrate specific communication functions into their applications with ease. Vonage handles most of the maintenance, allowing companies to focus on their core services while leveraging powerful communication capabilities.
CPaaS can include the following 2 categories:
Communication APIs:
- Voice
- SMS
- Video
- Authentication
- IP Chat
Network APIs:
- Silent Auth
- QoD
- Location
- Device Data
Implementation
Pre-requisites
For this demo you only need:
- Valid phone number
- Vonage Free Account
Create Vonage Account
Create your account here: https://dashboard.nexmo.com/sign-up.
Verify Your Account and Log In Securely
-
Click "Verify Email Address"
- After clicking, you will be redirected to a web page.
-
Enter Your Phone Number
- On the web page, you will see a phone number input screen.
- Enter your phone number, and you will receive an SMS with a verification code.
-
Enter the Verification Code
- Input the received verification code on the web page to complete your account creation.
-
Enable Extra Security (Optional)
- If you select "Repeat this step whenever I log in from an unusual device or location," SMS verification will be required each time you log in from a new device or IP address.
Vonage API Dashboard
Once you are registered and authenticated, you will access to Vonage API dashboard that highlights all the capabilities you as a brand-new API developer can achieve. Let's take a quick look on the Dashboard details:
Description:
Vonage Credit: Did I say Vonage is free? It was true! BUT until certain point. Think about this like an AWS Free credits benefit for API Gateway, based of course on # of API calls. Once you created your account, you will be granted a $10 Credit* to start playing with existing APIs, create Applications that use Vonage API and even setup integration with other vendors e.g. AWS, Azure, OpenAI among others.
API Key and API key: These are your unique ID to authenticate your account while testing Vonage APIs, so do not disclose to anyone unless you want to give away your free credit, or your whole wallet.
Troubleshoot & Learn: As it name implies, this is the section we will dive deep in this lab as it includes the 2 APIs we are going to work with: "Send a SMS" and "Verify User"
Vonage SMS API
By utilizing SMS, you can reduce the volume of incoming calls.
Benefits:
Various System Integrations
- 1 API call = 1 SMS sent → Easily integrates with other systems
Domestic Delivery Routes
- Redundancy with multiple suppliers for domestic delivery routes
- You can set your existing phone number as the Sender ID
- To avoid delivery blocks, you can register the message with the supplier
Delivery Feedback (Delivery Receipt "DLR")
- You can instantly check delivery results
Global Support
- Compliance with regulations in each country and application support
Reporting
- Usage and delivery reports, log search, and management screen available
- Custom report development is possible
SMS API - GUI Implementation:
SMS API call is quite straightforward, and your only concern will be how many characters you can use and if any special character is not allowed. Find below an example of a success SMS API call:
SMS API - Code Implementation:
To implement this using your favorite programming language, please refer to the following code. There are quite a few options to choose, but I will use Python for sake of easiness:
Install the library
pip install vonage
Initialize the library
client = vonage.Client(key="XXXXX", secret="YYYYYYY")
sms = vonage.Sms(client)
Write the code
responseData = sms.send_message(
{
"from": "Vonage APIs",
"to": "817014166666",
"text": "Hello from https://dev.to/mgonzalezo",
}
)
if responseData["messages"][0]["status"] == "0":
print("Message sent successfully.")
else:
print(f"Message failed with error: {responseData['messages'][0]['error-text']}")
Vonage Number verification API
The Verify API allows you to send a PIN to a user's phone and confirm its receipt. It can be used for authentication and fraud prevention, including two-factor authentication, passwordless login, and phone number verification.
Number verification API - GUI implementation:
You start by selecting the PIN length and send the verification SMS:
Notice there are 2 channels to notify the PIN Code, through SMS and up to 2 phone calls. This is possible due to the API design and specifications to include these alternatives
After PIN code is entered and verification is successful, you will get a report of the credits consumed.
Number verification API - Code Implementation:
Install the library
pip install vonage
Initialize the Library
client = vonage.Client(key="xxxxx", secret="yyyy")
verify = vonage.Verify(client)
Make a verification request
response = verify.start_verification(number="817014166666", brand="AcmeInc")
if response["status"] == "0":
print("Started verification request_id is %s" % (response["request_id"]))
else:
print("Error: %s" % response["error_text"])
Check the request with a code
response = verify.check(REQUEST_ID, code=CODE)
if response["status"] == "0":
print("Verification successful, event_id is %s" % (response["event_id"]))
else:
print("Error: %s" % response["error_text"])
Cancel The Request
response = verify.cancel(REQUEST_ID)
if response["status"] == "0":
print("Cancellation successful")
else:
print("Error: %s" % response["error_text"])
What is next?
For you, eager developer, the next step is to review the documentation for each of these 2 APIs and start thinking new integrations or variations for your own use case!
SMS API:
Number Verification API:
- https://developer.vonage.com/en/verify/overview
- https://developer.vonage.com/en/api/camara/number-verification#verifyNumberVerification
Create your own API using AWS?
I don't want to re-invent the wheel, so please check this interesting blog entry by Raktim Midya about Rest API implementation:
https://medium.com/geekculture/provision-resources-in-aws-using-your-own-rest-api-cc54b390a71f
Final words
That's a wrap! I hope you enjoy implementing these use cases and exploring more about Open API technologies.
Happy Learning!
Top comments (0)