মূল অংশে যান
W3 SMS

W3 SMS এপিআই Documentation

Integrate W3 SMS into your application with a few HTTP requests - send single and bulk SMS, check your balance and receive delivery reports.

  • Simple Integration
  • Secure Credentials
  • ডেলিভারি রিপোর্ট
  • Safe Retries

1. Getting Started

Welcome to the W3 SMS API Documentation

W3 SMS gives you a simple HTTP API to send SMS from your own software. This guide takes you from your credentials to your first message, then covers bulk sending, balance checks and delivery reports.

Fast IntegrationOne endpoint to send
Secure APIClient ID and Secret
ডেলিভারি রিপোর্টReal-time DLR push
Developer FriendlyExamples in 5 languages

2. API Endpoints

Send your requests to these URLs:

POST https://w3sms.com/send-message

SMS পাঠানো - form-urlencoded বা JSON body সহ POST।

POST https://w3sms.com/check-balance

Check balance.

Secret কখনো URL-এ রাখবেন না। দুটি এন্ডপয়েন্ট query parameter সহ GET-ও গ্রহণ করে, কিন্তু তাতে Secret URL-এর অংশ হয়ে যায় আর ওয়েব সার্ভার, প্রক্সি ও ব্রাউজারের লগে থেকে যায়। GET বড়জোর দ্রুত পরীক্ষার জন্য; production-এ HTTPS-এর ওপর POST ব্যবহার করুন।

3. Authentication

Pass your Client ID and Client Secret with every request. You can find them in your W3 SMS account, under Manage API Key.

clientIdYOUR_CLIENT_ID
clientSecretYOUR_CLIENT_SECRET
Keep your API credentials secure. Do not share them with anyone, and never put them in code that runs in a browser or a mobile app.

4. SMS পাঠান

Use the following endpoint to send a single SMS, or several in one call.

রিকোয়েস্ট প্যারামিটার

প্যারামিটারটাইপবর্ণনা
clientIdআবশ্যকstringYour unique client ID.
clientSecretআবশ্যকstringYour client secret.
senderIdআবশ্যকstringআপনার অ্যাকাউন্টে বরাদ্দ একটি অনুমোদিত সেন্ডার আইডি।
numbersআবশ্যকstringপ্রাপকের নম্বর। বাল্ক SMS-এর জন্য নম্বরগুলো কমা দিয়ে আলাদা করুন। উদাহরণ: 8801711578523,8801912345678
contentsআবশ্যকstringবার্তার লেখা। প্রতি SMS-এ ASCII সর্বোচ্চ ১৬০ অক্ষর, ইউনিকোড (যেমন বাংলা) সর্বোচ্চ ৭০ অক্ষর। URL-এনকোড করুন।
idempotency_keyঐচ্ছিকstringYour own reference for this send, e.g. an order number. Repeat a call with the same key and the original answer is returned instead of the message going out twice - the safe way to retry after a timeout. May also be sent as the Idempotency-Key header. Remembered for 24 hours.
asyncঐচ্ছিক0 / 1পাঠান 1 to queue the batch instead of waiting for the gateway. The balance is checked and charged straight away, and the call returns 202 একটি রেফারেন্সসহ। বড় ব্যাচের জন্য সুপারিশ করা হয়।
রেট লিমিট: 60 requests per minute
SMS sent through the API are delivered immediately. Scheduling is not supported through the API - use the Quick SMS panel in the dashboard for scheduled delivery.

উদাহরণ

Placeholder credentials are shown - sign in to your account for your own. Replace the number and text and it runs as it stands.

curl -X POST "https://w3sms.com/send-message" \
  -d "clientId=YOUR_CLIENT_ID" \
  -d "clientSecret=YOUR_CLIENT_SECRET" \
  -d "senderId=YOUR_SENDER_ID" \
  -d "numbers=8801711578523" \
  --data-urlencode "contents=Hello from W3SMS"

সফল রেসপন্স

{
  "status": 200,
  "message": "Message submitted successfully. Delivery status will update via DLR.",
  "accepted": 2,
  "rejected": 0,
  "charged": 1.0,
  "package_sms_used": 0
}

"Submitted" means the gateway accepted it. Whether each number actually received it arrives later as a delivery report - see Delivery Reports below. "charged" is what the wallet paid; "package_sms_used" is how many of the accepted SMS parts came out of a package instead (they cost nothing).

Success Response - queued (async=1)

{
  "status": 202,
  "reference": "batch_20260911105732_RXfjnh",
  "accepted": 250,
  "charged": 200.0,
  "message": "Batch accepted. Delivery status will update via DLR."
}
One call carries at most 500 recipients. এর চেয়ে বড় তালিকা প্রত্যাখ্যাত হয় 422 rather than partly sent - split it into batches.

5. বাল্ক এসএমএস

Send the same message to many recipients in one call - just provide a comma-separated list of numbers.

Example - Bulk SMS

curl -X POST "https://w3sms.com/send-message" \
  -d "clientId=YOUR_CLIENT_ID" \
  -d "clientSecret=YOUR_CLIENT_SECRET" \
  -d "senderId=YOUR_SENDER_ID" \
  -d "numbers=8801XXXXXXXXX,8801YYYYYYYYY" \
  --data-urlencode "contents=Hello from W3SMS"
চার্জ হিসাব হয় numbers x SMS parts x rate. Long ASCII messages (over 160 chars) and long Unicode messages (over 70 chars) count as multiple SMS parts.

বড় ব্যাচ পাঠানো

  • Keep each call to 500 recipients or fewer; a longer list is refused with 422 আংশিক পাঠানোর বদলে।
  • যোগ করুন async=1 যাতে ব্যাচ চার্জ কেটে সারিতে রাখামাত্র কলটি ফিরে আসে, গেটওয়ের অপেক্ষা না করে। নইলে বড় ব্যাচ আপনার HTTP টাইমআউট ছাড়িয়ে যেতে পারে, ফলে ব্যাচ গেছে কিনা আপনি নিশ্চিত থাকেন না।
  • যোগ করুন একটি idempotency_key so that if the connection drops and you retry, the batch is not sent - and charged - a second time.
  • ব্যাচটি হয় সবটা, নয় কিছুই না: ব্যালেন্স প্রতিটি প্রাপকের জন্য না কুলালে কাউকেই পাঠানো হয় না।

6. Check Balance

POST https://w3sms.com/check-balance

Required parameters: clientId, clientSecret.

রেট লিমিট: 30 requests per minute

উদাহরণ

curl -X POST "https://w3sms.com/check-balance" \
  -d "clientId=YOUR_CLIENT_ID" \
  -d "clientSecret=YOUR_CLIENT_SECRET"

সফল রেসপন্স

{
  "status": 200,
  "balance": 500.00
}

7. OTP এপিআই

দুটি কলে একটি ফোন নম্বর যাচাই করুন। প্রথমটি এসএমএসে একবার-ব্যবহারযোগ্য কোড পাঠায়; দ্বিতীয়টি ব্যবহারকারীর লেখা কোডটি মিলিয়ে দেখে। কোড তৈরি, নিরাপদে রাখা আর মেয়াদ শেষ করা আমাদের কাজ - আপনাকে কোড জমা রাখতে হয় না।

ধাপ ১ - কোড পাঠান

POST https://w3sms.com/send-otp
প্যারামিটারটাইপবর্ণনা
clientIdstringআপনার ক্লায়েন্ট আইডি।
clientSecretstringআপনার ক্লায়েন্ট সিক্রেট।
senderIdstringআপনার অ্যাকাউন্টের একটি অনুমোদিত সেন্ডার আইডি।
numberstringএকটি বাংলাদেশি মোবাইল নম্বর। 01XXXXXXXXX বা 8801XXXXXXXXX দুটোই চলবে।
messageঐচ্ছিকstringআপনার নিজের ভাষায় বার্তা। কোড যেখানে বসবে সেখানে {otp} থাকতে হবে; {minutes} মেয়াদ দিয়ে বদলে যাবে। না দিলে সাধারণ বার্তা যাবে।
lengthঐচ্ছিক4 - 8কোডে কয়টি ডিজিট থাকবে। ডিফল্ট ৬।
expiryঐচ্ছিক1 - 15কোডটি কত মিনিট বৈধ থাকবে। ডিফল্ট ৫।

উদাহরণ

curl -X POST "https://w3sms.com/send-otp" \
  -d "clientId=YOUR_CLIENT_ID" \
  -d "clientSecret=YOUR_CLIENT_SECRET" \
  -d "senderId=YOUR_SENDER_ID" \
  -d "number=01XXXXXXXXX"

উদাহরণ - নিজের বার্তা, দৈর্ঘ্য ও মেয়াদসহ

curl -X POST "https://w3sms.com/send-otp" \
  -d "clientId=YOUR_CLIENT_ID" \
  -d "clientSecret=YOUR_CLIENT_SECRET" \
  -d "senderId=YOUR_SENDER_ID" \
  -d "number=01XXXXXXXXX" \
  --data-urlencode "message=Your MyShop login code is {otp}. Valid for {minutes} minutes." \
  -d "length=6" \
  -d "expiry=5"

সফল রেসপন্স

{
  "status": 200,
  "message": "OTP sent successfully.",
  "request_id": "otp_k3j9x0q2m7v1b5n8c4z6a1d9",
  "number": "01711223344",
  "expires_in": 300,
  "resend_after": 60,
  "charged": 0.35
}

ধাপ ২-এ কোড যাচাইয়ের জন্য request_id সংরক্ষণ করুন। চাইলে ফোন নম্বর দিয়েও যাচাই করা যায়।

ধাপ ২ - কোড যাচাই করুন

POST https://w3sms.com/verify-otp
প্যারামিটারটাইপবর্ণনা
clientIdstringআপনার ক্লায়েন্ট আইডি।
clientSecretstringআপনার ক্লায়েন্ট সিক্রেট।
otpstringব্যবহারকারী যে কোডটি লিখেছেন।
request_idযেকোনো একটিstringধাপ ১ থেকে পাওয়া আইডি।
numberযেকোনো একটিstringrequest_id রাখা না থাকলে ফোন নম্বর দিন। ওই নম্বরের সর্বশেষ কোডটি যাচাই হবে।

উদাহরণ

curl -X POST "https://w3sms.com/verify-otp" \
  -d "clientId=YOUR_CLIENT_ID" \
  -d "clientSecret=YOUR_CLIENT_SECRET" \
  -d "request_id=otp_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -d "otp=482915"

রেসপন্স

{
  "status": 200,
  "verified": true,
  "message": "OTP verified."
}
{
  "status": 422,
  "verified": false,
  "code": "wrong_code",
  "message": "That code is not correct.",
  "tries_left": 4
}
অন্তর্নির্মিত সুরক্ষা। একটি কোড একবারই কাজ করে। 5বার ভুল করলে কোডটি বাতিল হয়ে যায়। একই নম্বরে নতুন কোড পাঠালে আগেরটি বাতিল হয়। একটি নম্বরে 60 সেকেন্ডে একবার এবং ঘণ্টায় সর্বোচ্চ 5বার পাঠানো যায়, তাই কোনো বট আপনার ফর্ম দিয়ে ফোন ভরিয়ে দিতে বা ব্যালেন্স শেষ করতে পারবে না।
প্রতিটি কোড একটি এসএমএস এবং অন্য বার্তার মতোই বিল হয় - আগে প্যাকেজ থেকে, তারপর ওয়ালেট থেকে। নম্বর প্রত্যাখ্যাত হলে কোনো চার্জ কাটা হয় না। কোড যাচাই বিনামূল্যে।
রেট লিমিট: পাঠানো: 60 requests per minute; যাচাই: 120 requests per minute

8. Delivery Reports (DLR Push)

Instead of polling for status, we push a real-time webhook to your server whenever an SMS is delivered or fails. Set your Success and Fail URLs under DLR Push Config in your account.

কীভাবে কাজ করে

  • SMS ডেলিভারি হয়েছে - আমরা অনুরোধ পাঠাই আপনার সফলতার URL
  • SMS ব্যর্থ হয়েছে - আমরা অনুরোধ পাঠাই আপনার ব্যর্থতার URL
  • মেথড (GET / POST) DLR সেটিংসে কনফিগার করা যায়।

ওয়েবহুক পেলোড

ঘরবর্ণনা
message_idSMS পাঠানোর সময় ফেরত আসা অনন্য বার্তা আইডি।
numberপ্রাপকের ফোন নম্বর।
statusdelivered অথবা failed
raw_statusআপস্ট্রিম গেটওয়ের কাঁচা স্ট্যাটাস স্ট্রিং।
sent_atSMS যখন জমা দেওয়া হয়েছে (ISO 8601)।
reported_atডেলিভারি রিপোর্ট যখন পাওয়া গেছে (ISO 8601)।

উদাহরণ পেলোড (POST JSON)

{
  "message_id": "296334",
  "number": "8801XXXXXXXXX",
  "status": "delivered",
  "raw_status": "success",
  "sent_at": "2026-05-31T18:05:45+06:00",
  "reported_at": "2026-05-31T18:12:10+06:00"
}
আপনার ওয়েবহুক URL পাবলিকলি পৌঁছানোর যোগ্য হতে হবে (localhost নয়)। প্রাপ্তি স্বীকার করতে HTTP 200 দিয়ে উত্তর দিন।

9. স্ট্যাটাস কোড

HTTP / স্ট্যাটাসঅর্থকখন ঘটে
200গৃহীতগেটওয়ে বার্তাটি নিয়েছে এবং আপনার ব্যালেন্স থেকে চার্জ কাটা হয়েছে। ডেলিভারি নিজে পরে DLR দিয়ে জানানো হয়।
202কিউতে আছেশুধু যখন async=1. চার্জ কেটে সারিতে রাখা হয়; রেসপন্সে থাকে একটি reference.
404ইউজার পাওয়া যায়নিঅবৈধ clientId অথবা clientSecret.
404সেন্ডার আইডি পাওয়া যায়নিএই senderId আপনার অ্যাকাউন্টে বরাদ্দ নেই।
406ব্যালেন্স অপর্যাপ্তYour wallet cannot cover the part of the send that package SMS do not. Nothing is taken. Having no package, or an expired one, does not stop a send: the wallet is charged at your account rate.
406গেটওয়ে নেইNo active SMS gateway is configured. Contact support.
406ফোন নম্বর অবৈধগেটওয়ে গন্তব্য নম্বর প্রত্যাখ্যান করেছে।
406এই সেন্ডার ধরনের রেট নেইYour account has no rate for this sender ID's type and no package holds SMS of that type, so the message cannot be priced.
409একই অনুরোধ চলছেএকই এর আগের একটি কল idempotency_key এখনো চলছে। আবার চেষ্টা না করে সেটির জন্য অপেক্ষা করুন।
410কোডের মেয়াদ শেষ বা ব্যবহৃতOTP যাচাই: কোডটি কখনো দেওয়া হয়নি, মেয়াদ শেষ, আগেই ব্যবহৃত, অথবা নতুন কোড দিয়ে বাতিল হয়েছে।
422ভ্যালিডেশন ত্রুটিA required parameter is missing or malformed, or the list held more than 500 recipients.
429অনেক বেশি অনুরোধOTP: এই নম্বরে এইমাত্র কোড পাঠানো হয়েছে, নম্বরটির ঘণ্টাভিত্তিক সীমা পূর্ণ হয়েছে, অথবা অনেকবার ভুল কোড দেওয়া হয়েছে। রেসপন্সে বলা থাকে কতক্ষণ অপেক্ষা করতে হবে।
502গেটওয়ে প্রত্যাখ্যান করেছেEvery gateway turned the batch down. Nothing was sent and the charge was returned to your balance.
503কোনো গেটওয়ে নেইNo SMS gateway is active. Contact support.
চার্জ যেভাবে কাজ করে। The whole batch is priced before anything is sent - if your balance will not cover all of it, nothing goes and you get 406. If a gateway then refuses the batch the charge is put straight back; if a delivery report later says a message never arrived, that message is refunded; and if no delivery report arrives within 48 hours, it is settled as undelivered and refunded then. Every movement appears in your transaction history.

10. WordPress প্লাগইন

Sending from a WordPress site? Skip the code above - install the official plugin instead: a Settings screen for the same credentials, a one-function API (w3sms_send_sms()), and optional automatic SMS on WooCommerce order updates and Contact Form 7 submissions.

ইনস্টলেশন

  • wp-admin - Plugins - Add New - Upload Plugin, choose the downloaded zip, then Install and Activate.
  • Open Settings - W3 SMS and enter your Client ID, Client Secret and Default Sender ID.
  • কাজ করছে কিনা নিশ্চিত করতে একই স্ক্রিনের Send Test SMS টুল ব্যবহার করুন।

ফাংশনের রেফারেন্স

ফাংশনফেরত দেয়নোট
w3sms_send_sms( $numbers, $message, $sender = null )true | WP_Error$numbers একটি MSISDN বা কমা দিয়ে আলাদা করা কয়েকটি নেয়। $sender সংরক্ষিত ডিফল্ট বদলে দেয়।
w3sms_check_balance()float | WP_Errorঅ্যাকাউন্টের ব্যালেন্স, API যে কারেন্সিতে জানায় সেই কারেন্সিতে।
A failed WooCommerce or Contact Form 7 notification never blocks checkout or the form submission - it is written to the PHP error log only. Full reference: DOCUMENTATION.md in the zip.

11. WHMCS মডিউল

Running a hosting or billing business on WHMCS? This addon texts your clients automatically - new invoice, payment received, a staff reply on their ticket, or a service suspension - each one an independent on/off switch in the module's settings.

ইনস্টলেশন

  • zip এমনভাবে এক্সট্র্যাক্ট করুন যাতে আপনার WHMCS ইনস্টলে পাথ হয় modules/addons/w3sms/w3sms.php।
  • Admin area - Setup - Addon Modules - find W3 SMS - Activate.
  • Click Configure: enter your Client ID, Client Secret and Default Sender ID, tick the events you want, and grant your admin role access.
  • Open Addons - W3 SMS and use the Send Test SMS tool to confirm it works.

নোটিফিকেশন ইভেন্ট

সেটিংWHMCS হুকClient is texted when...
নতুন ইনভয়েসে SMSInvoiceCreatedতার জন্য একটি ইনভয়েস তৈরি হয় (রিকারিং বা একবারের)।
পেমেন্ট পাওয়ায় SMSInvoicePaidতার একটি ইনভয়েস Paid চিহ্নিত হয়।
স্টাফের টিকেট উত্তরে SMSTicketAdminReplyকোনো স্টাফ তার খোলা সাপোর্ট টিকেটে উত্তর দেয়।
সার্ভিস স্থগিতে SMSAfterModuleSuspendone of their hosting services is suspended.
A failed notification never blocks the invoice, payment, ticket reply or suspension it was about - it is written to the WHMCS Activity Log only. Full reference: DOCUMENTATION.md in the zip.