📶Send SMS
Send a text message
POST
https://api.krezypay.com/v1/sandbox/services/send_sms
Body
Name
Type
Description
userID
string
This is your account identifier indicating whether you are in production or in test
label
string
The name of the company or the product label
phone
string
The number that will receive the SMS
content
string
The content of the SMS
Response
{
"status": "success",
"message": "SMS sent successfully"
}
// Define the endpoint URL
const url = "https://api.krezypay.com/v1/sandbox/services/send_sms";
// Create the request body
const requestBody = {
userID: "pwowhL5g0v9Sx1m3qlcrj1o8Z5J2Acb8kad5E7f3gmau9iye8zuPUV6MhtRIFqnQ7p6OjzdC10Wk24bs....",
phone: "+182938516..",
label: "TEST",
content: "Welcome to TEST COMPANY"
};
// Make the POST request
fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(requestBody)
})
.then(response => {
// Check if the response is okay
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
// Parse the JSON response
return response.json();
})
.then(data => {
// Log the success message
console.log("Success:", data);
})
.catch(error => {
// Log any errors that occurred
console.error("Error:", error);
});
Last updated