Untitled

mail@pastecode.io avatar
unknown
plain_text
10 months ago
784 B
3
Indexable
Never
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);