APON SMS Hub โ€” Connection Guide

The phone app forwards every bKash / Nagad / Rocket money-received SMS to the hub. Websites and bots ask the hub to claim a Transaction ID. A TrxID can be claimed once โ€” after any connection uses it, every other connection gets already_used.

๐Ÿ“ฑ Phone app  โ”€โ”€โ–บ  Hub  โ—„โ”€โ”€ claim โ”€โ”€  Website
                     โ—„โ”€โ”€ claim โ”€โ”€  Bot 1, Bot 2, โ€ฆ

1. Phone app โ†’ Hub

The hub checks the X-Signature header = hex HMAC-SHA256(secret, raw body). Wrong signature โ†’ 403.

2. Create a connection

Admin โ†’ Dashboard โ†’ Connections โ†’ + New Connection. Copy the API key (shown once). Send it as Authorization: Bearer <key>. Keep it on the server, never in a browser or app.

3. API

POST /v1/claim โ€” use a TrxID (atomic, one use ever)

{"wallet":"bkash","trx_id":"BKA1B2C3D4","ref":"invoice-1234","min_amount":288}

Success: {"ok":true,"sms":{"wallet":"bkash","trx_id":"โ€ฆ","amount":288,"counterparty":"1712345678","sms_time":"โ€ฆ"}}
Errors (ok:false): not_found (SMS not arrived yet โ€” retry in a minute), already_used, not_payment (needs admin review), amount_too_low.

GET /v1/check?wallet=bkash&trx_id=โ€ฆ โ€” look up without using it.
GET /v1/numbers โ€” active payment numbers {"bkash":[{"number":"01โ€ฆ","type":"personal"}],โ€ฆ}. Show these to customers so a number change is made in one place.

4. Examples

Python

import requests
HUB, KEY = "https://sms.aponcloudx.com", "hub_xxx"   # keep KEY in .env
r = requests.post(f"{HUB}/v1/claim", json={"wallet": "nagad", "trx_id": trx, "ref": f"order-{order_id}",
                  "min_amount": amount_bdt}, headers={"Authorization": f"Bearer {KEY}"}, timeout=15).json()
if r["ok"]: credit(user, r["sms"]["amount"])
elif r["error"] == "not_found": ask_user_to_wait()
else: show(r.get("message"))

Node.js

const r = await fetch(HUB + '/v1/claim', { method: 'POST',
  headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + process.env.SMS_HUB_KEY },
  body: JSON.stringify({ wallet: 'bkash', trx_id, ref: 'inv-' + id, min_amount: bdt }) }).then(r => r.json());

5. Rules