Skip to content

An open source Node.js SDK that allows you to access the Hubtel Programmable SMS API from your Node.js application.

License

Notifications You must be signed in to change notification settings

clarnx/hubtel-sms-nodejs-v1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hubtel-sms-nodejs-v1

An open source Node.js SDK that allows you to access the Hubtel Programmable SMS API from your Node.js application.

Demo

import { ServerResponse as HttpResponse} from "http";
import BasicAuth from "@/Hubtel/BasicAuth";
import ApiHost from "@/Hubtel/ApiHost";
import MessagingApi from "@/Hubtel/MessagingApi";
import MessageResponse from "@/Hubtel/MessageResponse";


async function main() {
    const auth = new BasicAuth("user123", "pass123");
    // instance of ApiHost
    const apiHost = new ApiHost(auth);
    // Let us try to send some message
    const messagingApi = new MessagingApi(apiHost);
    try {
        // Send a quick message
        const messageResponse: any = await messagingApi.sendQuickMessage("DevUniverse", "+233207110652", "Welcome to planet Hubtel!");

        if (messageResponse instanceof MessageResponse) {
            console.log(messageResponse.getStatus());
        } else if (messageResponse instanceof HttpResponse) {
            console.log(`\nServer Response Status : ".${messageResponse.statusMessage}`);
        }
    } catch (error: any) {
        console.error(error.message);
    }
}

main()

About

An open source Node.js SDK that allows you to access the Hubtel Programmable SMS API from your Node.js application.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published