var xhr = new XMLHttpRequest(),
body = JSON.stringify(
{
"messages": [
{
"channel": "whatsapp",
"to": "5521964336169",
"content": "Test WhatsApp Message Text"
},
{
"channel": "sms",
"to": "5521964336169",
"content": "Test SMS Message Text"
}
]
}
);
xhr.open('POST', 'https://platform.clickatell.com/v1/message', true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('Authorization', '2HM0QuCyTEyTBWQCam9bcA==');
xhr.onreadystatechange = function(){
if (xhr.readyState == 4 && xhr.status == 200) {
console.log('success');
}
};
xhr.send(body);