Example api code for Promotional SMS in node,js

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);
});

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Example api code for Promotional SMS in php

Replace user, password, msisdn, sid and message accordingly.   1. Below is the sample code for...

Example api code for Promotional SMS in asp.net

Replace user, password, msisdn, sid and message accordingly.   1. Below is the sample code for...

Example api code for Promotional SMS in java

Replace user, password, msisdn, sid and message accordingly.   1. Below is the sample code for...

Example api code for Promotional SMS in ruby

Replace user, password, msisdn, sid and message accordingly.   1. Below is the sample code for...

Example api code for Promotional SMS in python

Replace user, password, msisdn, sid and message accordingly.   1. Below is the sample code for...