telbiz-sdk-ts
v1.0.1
Published
Unofficial Telbiz API SDK for Node.js/TypeScript
Downloads
24
Maintainers
Readme
Telbiz TS SDK
🛠️ TypeScript-ready SDK for Telbiz API This package (
telbiz-sdk-ts) is a modern reimplementation of the original telbiz package, with full TypeScript support and typings.Supports SMS sending and mobile top-up via Telbiz API.
📦 Installation
npm install telbiz-sdk-tsor
yarn add telbiz-sdk-ts🚀 Usage
TypeScript / ES Module
import { Telbiz } from "telbiz-sdk-ts";
const tb = new Telbiz("XXXXX253832870000", "b266ef94-bb18-4ff2-8f38-e358f130XXXX");
(async () => {
try {
const sms = await tb.SendSMSAsync(tb.SMSHeader.OTP, "209961XXXX", "Hello OTP");
console.log("SMS:", sms);
const topup = await tb.SendTopupAsync("205504XXXX", 10000);
console.log("Topup:", topup);
} catch (err) {
console.error("Error:", err);
}
})();CommonJS
const { Telbiz } = require("telbiz-sdk-ts");
const tb = new Telbiz("XXXXX253832870000", "b266ef94-bb18-4ff2-8f38-e358f130XXXX");
tb.SendSMSAsync(tb.SMSHeader.Default, "209961XXXX", "Hi ... 1")
.then((rs) => console.log("SMS:", rs))
.catch((err) => console.error("Error: ", err));
tb.SendTopupAsync("205504XXXX", 10000)
.then((rs) => console.log("Topup:", rs))
.catch((err) => console.error("Error: ", err));📖 API Reference
new Telbiz(ClientID: string, Secret: string)
Initialize a new Telbiz client.
tb.SMSHeader
Available headers:
DefaultNewsPromotionOTPInfoUnknown
tb.SendSMSAsync(header: string, phone: string, message: string): Promise<any>
Send an SMS.
header→ One oftb.SMSHeader.*phone→ Must start with20or30message→ Message text
tb.SendTopupAsync(phone: string, amount: number): Promise<any>
Send a mobile top-up.
phone→ Must start with20or30amount→ Must be at least 5000
⚠️ Notes
- Phone number must start with
20or30 - Phone number length must not exceed 10 digits
- Topup amount must be at least
5000 - Requires valid Telbiz ClientID & Secret
📜 Related
- telbiz (JavaScript only) — Original package
- telbiz-sdk-ts — TypeScript-ready version (this package)
🔗 Links
🛡 License
MIT © [SENG DEV]
