How does it work?
Create an account
Registration is free. You only need an email and password.
Top up your credit and get your API key
After creating your account, you can top up your credit and get your API key. Credit can be topped up via bank transfer or credit card.
Use your API key
Your API key serves as credentials for sending messages. Now connect your system to our API and you can start sending messages. Code samples and existing libraries for various programming languages are available.
Usage examples
- PHP
- JavaScript SDK
- Node.js
<?php
$apikey = 'your-api-key-here'; // Replace with your actual API key
$number = 'phone-number-here'; // Replace with the target phone number
$text = 'message-text-here'; // Replace with the message text
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.smsmngr.com/v2/message');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array(
'to' => array(array('phone_number' => $number)),
'body' => $text
)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'x-api-key:' . $apikey
));
// Execute the request and capture the response
$response = curl_exec($ch);
curl_close($ch);
// Process the response
$response = json_decode($response, true);
if ($response['accepted'] && $response['accepted'][0]) { // SMS was sent successfully
echo 'Status: Accepted';
echo 'ID: ' . $response['accepted'][0]['message_id'];
} else {
echo 'Status: Rejected';
}
const SmsManager = require('smsmanager-js-api');
const sender = new SmsManager('your-api-key-here');
sender.send('phone-number-here', 'Your message text')
.then(result => {
if (result.success) {
console.log('SMS sent successfully. Message ID:', result.messageId);
} else {
console.log('Failed to send SMS');
}
})
.catch(error => {
console.error('Error sending SMS:', error);
});
const response = await fetch('https://api.smsmngr.com/v2/message', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'your-api-key-here'
},
body: JSON.stringify({
to: [{
phone_number: 'phone-number-here'
}],
body: 'message-text-here'
})
});
const responseText = await response.json();
if(response.accepted && response.accepted[0]){ // SMS was sent successfully
console.log('Status: Accepted');
console.log('ID:', response.accepted[0].message_id);
}
else{
console.log('Status: Rejected');
}