bulksmsbd

A robust, production-ready Dart & Flutter wrapper for the bulksmsbd.net SMS gateway API. Developed and maintained by Sofol IT.

Table of Contents

Features

  • Send SMS to single or multiple numbers
  • Send different messages to different numbers (bulk SMS)
  • Send OTP messages with branded sender name
  • Check account balance
  • Comprehensive error handling with descriptive messages
  • Supports all bulksmsbd.net error codes

Getting started

Prerequisites

  • Dart SDK >=3.0.0 <4.0.0
  • An active bulksmsbd.net account
  • API key and approved Sender ID from your account dashboard

Account Setup

Before using the API, you must disable IP whitelisting in your bulksmsbd.net account:

  1. Log in to your bulksmsbd.net dashboard
  2. Go to Phone Book menu → IP White List
  3. At the top, in the IP White Listing Setting section, set it to disabled
  4. Enter the OTP sent to your registered mobile number
  5. You're now ready to use the API from any IP

Installation

Add to your pubspec.yaml:

dependencies:
  bulksmsbd: ^1.0.3

Usage

Import

import 'package:bulksmsbd/bulksmsbd.dart';

Initialize client

final smsClient = BulkSmsBd(
  apiKey: 'your_api_key',
  senderId: 'your_sender_id',
);

Send SMS to one or more numbers

final response = await smsClient.sendSms(
  numbers: ['88017XXXXXXXX', '88018XXXXXXXX'],
  message: 'Your message here',
);

if (response.isSuccess) {
  print('SMS sent: ${response.message}');
} else {
  print('Failed: ${response.message}');
}

Send different messages to different numbers

final response = await smsClient.sendBulkSms(messages: [
  BulkSmsBulkItem(to: '88017XXXXXXXX', message: 'First message'),
  BulkSmsBulkItem(to: '88018XXXXXXXX', message: 'Second message'),
]);

Send OTP

final response = await smsClient.sendOtp(
  number: '88017XXXXXXXX',
  brandName: 'YourBrand',
  otp: '123456',
);
// Sends: "Your YourBrand OTP is 123456"

Check balance

final balance = await smsClient.getBalance();
print('Remaining balance: $balance BDT');

Clean up

smsClient.close();

API Reference

BulkSmsBd

Method Parameters Returns Description
sendSms numbers, message BulkSmsResponse Send SMS to comma-joined numbers
sendBulkSms messages BulkSmsResponse Send different messages to different numbers
sendOtp number, brandName, otp BulkSmsResponse Convenience method for OTP SMS
getBalance String Check remaining account balance
close void Release HTTP client resources

BulkSmsResponse

Property Type Description
successCode String API response code
message String Success or error message
isSuccess bool true when code is 202

Response codes

Code Meaning
202 SMS submitted successfully
1001 Invalid number
1002 Sender ID not correct / disabled
1003 Required fields missing / Contact system administrator
1005 Internal error
1006 Balance validity not available
1007 Balance insufficient
1011 User ID not found
1012 Masking SMS must be sent in Bengali
1013 Sender ID has not found gateway by API key
1014 Sender type name not found using this sender by API key
1015 Sender ID has not found any valid gateway by API key
1016 Sender type name active price info not found
1017 Sender type name price info not found
1018 The owner of this account is disabled
1019 Sender type name price of this account is disabled
1020 The parent of this account is not found
1021 The parent active sender type name price not found
1031 Account not verified — contact administrator
1032 IP not whitelisted

Additional information

Contributions are welcome. Please file issues or submit pull requests on GitHub.

Libraries

bulksmsbd
A Dart & Flutter wrapper for the bulksmsbd.net SMS gateway API.