Developer Documentation
Introduction
Welcome to the developer documentation. Here you will find all the necessary information to get started with our API.
Making a Request
To add a new client, you need to send a GET request to our server. You will need to include the phone number of the client as a query parameter.
Url for the phone number request:
GET https://whatsappbot-functions.azurewebsites.net/api/user?phone_number=
JavaScript Example
Below is an example of a JavaScript function that sends a phone number to our server:
function sendPhoneNumber() {
var phoneNumber = document.getElementById('phone_number').value;
var responseMessageDiv = document.getElementById('response-message');
responseMessageDiv.innerText = '';
var url = 'https://whatsappbot-functions.azurewebsites.net/api/user?phone_number=' + encodeURIComponent(phoneNumber);
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
responseMessageDiv.innerText = "Registration successful! Please check WhatsApp for further instructions.";
} else if (xhr.status === 400) {
responseMessageDiv.innerText = "Bad request. Please check the phone number and try again.";
} else if (xhr.status === 429) {
responseMessageDiv.innerText = "Too many requests. Please try again later.";
} else {
responseMessageDiv.innerText = "Registration failed. Please try again.";
}
console.log('Request sent successfully. Status:', xhr.status);
}
};
xhr.send();
}
This function retrieves the phone number from an input field, sends it to the server, and handles the response accordingly.
Response statuses:
- 200: Registration successful.
- 400: Bad request. Please check the phone number.
- 429: Too many requests. Please try again later.
- Other: Registration failed. Please try again.