Replace user, password, msisdn, sid and message accordingly.
1. Below is the sample code for node.js for Single Message:
const axios = require('axios');
const user = 'abc';
const password = 'xyz';
const msisdn = '919898xxxxxx';
const sid = 'SenderId';
const message = 'test message';
const fl = '0';
const apiUrl = `http://sms.domainadda.com/vendorsms/pushsms.aspx?user=${user}&password=${password}&msisdn=${msisdn}&sid=${sid}&msg=${encodeURIComponent(message)}&fl=${fl}`;
axios.get(apiUrl)
.then(response => {
console.log('API response:', response.data);
})
.catch(error => {
console.error('Error sending request:', error);
});
2. Below is the sample code for node.js for Multiple Messages:
const axios = require('axios');
const user = 'abc';
const password = 'xyz';
const msisdns = '919898xxxxxx,919898xxxxxx'; // Comma-separated list of phone numbers
const sid = 'SenderId';
const message = 'test message';
const fl = '0';
const apiUrl = 'http://sms.domainadda.com/vendorsms/pushsms.aspx';
const params = new URLSearchParams({
user,
password,
msisdn: msisdns,
sid,
msg: message,
fl,
});
axios.post(apiUrl, params)
.then(response => {
console.log('API response:', response.data);
})
.catch(error => {
console.error('Error sending request:', error);
});