Sending SMS through BulkSMS gateway from Docly JS API Last updated: 19. Dec 2025

This example will send an SMS from your Docly JS API to a phonenumber. It requires an account at BulkSMS and credits.

Example

Code #/API/SMS.js

export default () => {
    let data = {
        "to": "+123", // number to send SMS to
        "body": "Hello from Docly™", // message to send
        "encoding": "UNICODE", // encoding, unicode recommended
        //"from" : "MyID" // sender ID, optional
    };
    
    // You need a BULKSMS account - create one here: https://www.bulksms.com/
    let login = "BULK SMS username"; // insert your username here
    let pass = "BULK SMS password"; // insert your password here
    
    let auth = "Basic " + docly.base64(login + ":"  + pass);
    let headers = { "Authorization" : auth };
    
    let url = "https://api.bulksms.com/v1/messages";
    let result = docly.httpPost(url, data, headers);
    return result;
}