bridgexapi
v0.1.0
Published
Official BridgeXAPI Node.js SDK for SMS submission and DLR retrieval
Maintainers
Readme
BridgeXAPI Node.js SDK
Official BridgeXAPI Node.js SDK for SMS submission and delivery retrieval.
Install
npm install bridgexapiQuick Start
import { BridgeXAPI, Route } from "bridgexapi";
const client = new BridgeXAPI({
apiKey: "YOUR_API_KEY",
baseUrl: "https://hi.bridgexapi.io"
});
const result = await client.sendSMS({
routeId: Route.ROUTE_3,
callerId: "BRIDGEXAPI",
numbers: ["34615234567"],
message: "Your verification code is 4839."
});
console.log(result);Features
- SMS submission
- Single-recipient helper
- Delivery retrieval by
bx_id - Delivery retrieval by
order_id - Request validation
- Structured error handling
Usage
Send SMS
import { BridgeXAPI, Route } from "bridgexapi";
const client = new BridgeXAPI({
apiKey: "YOUR_API_KEY"
});
const result = await client.sendSMS({
routeId: Route.ROUTE_1,
callerId: "BRIDGEXAPI",
numbers: ["34615234567", "34615234568"],
message: "BridgeXAPI test message."
});
console.log(result);Send one SMS
const result = await client.sendOne({
routeId: 3,
callerId: "BRIDGEXAPI",
number: "34615234567",
message: "Single SMS example."
});Get DLR by bx_id
const dlr = await client.getDLRByBxId("BXMSG_8d3ca2210f");
console.log(dlr);Get order DLR
const dlr = await client.getOrderDLR("BX-20260314-001245");
console.log(dlr);Errors
The SDK throws structured errors:
AuthenticationErrorValidationErrorAPIRequestErrorNetworkError
Example:
try {
await client.sendSMS({
routeId: 99,
callerId: "BRIDGEXAPI",
numbers: ["34615234567"],
message: "Hello"
});
} catch (err) {
console.error(err.name);
console.error(err.message);
console.error(err.statusCode);
console.error(err.data);
}Constructor
const client = new BridgeXAPI({
apiKey: "YOUR_API_KEY",
baseUrl: "https://hi.bridgexapi.io",
timeout: 30000
});Route Constants
import { Route } from "bridgexapi";
Route.ROUTE_1
Route.ROUTE_2
Route.ROUTE_3
Route.ROUTE_4
Route.ROUTE_5
Route.ROUTE_6Notes
routeIdmust be between 1 and 6callerIdmust be between 3 and 11 charactersnumbersmust contain digit-only MSISDN valuesmessagemust be non-empty
Links
- Dashboard: https://dashboard.bridgexapi.io
- API Base URL: https://hi.bridgexapi.io
