आपको क्या चाहिए
- ऐसा हार्डवेयर जो आपका अपना सॉफ़्टवेयर चलाए या HTTP अनुरोध भेजे (मॉडेम पूल, SIM बैंक, GoIP)
- आपके देश में कानूनी रूप से आपके या आपकी कंपनी के नाम पर रजिस्टर SIM कार्ड
- स्वीकृत गेटवे आवेदन
अपना मॉडेम पूल, SIM बैंक या GoIP गेटवे साइन किए गए REST API से जोड़ें। पोर्ट रजिस्टर करें, heartbeat भेजें, आने वाले SMS आगे भेजें और हर असाइनमेंट की पुष्टि webhook, long-poll या heartbeat से करें।
इस तरीके से आपका हिस्सा: हर बिक्री का 100%।
अपने हार्डवेयर, ऑपरेटरों और लाइनों की संख्या बताएँ। हर आवेदन की समीक्षा एक इंसान करता है।
स्वीकृति के बाद डैशबोर्ड में गेटवे बनाएँ। आपको एक कुंजी और एक सीक्रेट मिलता है जो एक बार दिखते हैं।
हर पोर्ट उसके नंबर और ऑपरेटर के साथ भेजें, फिर हर लाइन की पुष्टि हमारे दिए SMS कोड से करें।
heartbeat भेजें, हर आने वाला SMS आगे भेजें और असाइनमेंट की पुष्टि करें। आपकी लाइनें पूल की किसी भी दूसरी लाइन की तरह बिकती हैं।
HTTPS पर JSON API। हर अनुरोध आपके गेटवे सीक्रेट से साइन होता है, इसलिए सिर्फ़ कुंजी देखने वाले के किसी काम की नहीं।
https://smsgrab.com/api/supply/v1
हर अनुरोध के साथ ये चार हेडर भेजें। टाइमस्टैम्प हमारी घड़ी से 5 मिनट के भीतर हो और हर nonce एक बार इस्तेमाल हो।
SmsGrab-KeySmsGrab-TimestampSmsGrab-NonceSmsGrab-Signatureइन सात हिस्सों को नई लाइन से जोड़ें: तय प्रीफ़िक्स SGSUPPLY1, HTTP मेथड, भेजा गया पाथ, कच्ची क्वेरी स्ट्रिंग (या कुछ नहीं), टाइमस्टैम्प, nonce और बॉडी का SHA-256 छोटे अक्षरों वाले hex में (बॉडी न हो तो खाली स्ट्रिंग का)। इसे अपने सीक्रेट से साइन करें।
SGSUPPLY1
POST
/api/supply/v1/messages
1790503200
3q9ZkQe7Tn2vYp8LwXc1Ab
a507e2e670909f12a167f25eb94140a4b5f799b75cc1d9a6c736eead88501bbe
secret sgss_AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8
body {"messages":[{"id":"gw-7781","port":"1","from":"WhatsApp","text":"Your WhatsApp code: 123-456","received_at":"2026-11-28T10:00:00Z"}]}
signature v1=db3e086faba31b85c508811b82a90d73c19719d650e03602fdd2d5a02b381618
Python
import hashlib, hmac, json, os, secrets, time, urllib.parse
import requests
KEY_ID = os.environ["SMSGRAB_SUPPLY_KEY"]
SECRET = os.environ["SMSGRAB_SUPPLY_SECRET"].encode()
def signed(method, url, payload=None):
body = b"" if payload is None else json.dumps(payload, separators=(",", ":")).encode()
parts = urllib.parse.urlsplit(url)
timestamp = str(int(time.time()))
nonce = secrets.token_urlsafe(24)
canonical = "\n".join(["SGSUPPLY1", method, parts.path, parts.query,
timestamp, nonce, hashlib.sha256(body).hexdigest()])
headers = {
"SmsGrab-Key": KEY_ID,
"SmsGrab-Timestamp": timestamp,
"SmsGrab-Nonce": nonce,
"SmsGrab-Signature": "v1=" + hmac.new(SECRET, canonical.encode(), hashlib.sha256).hexdigest(),
}
if body:
headers["Content-Type"] = "application/json"
return requests.request(method, url, data=body or None, headers=headers, timeout=30)
signed("POST", "https://smsgrab.com/api/supply/v1/messages", {"messages": [{
"id": "gw-7781", "port": "1", "from": "WhatsApp",
"text": "Your WhatsApp code: 482-913", "received_at": "2026-11-28T10:00:00Z",
}]})
Node.js
import { createHash, createHmac, randomBytes } from 'node:crypto';
const keyId = process.env.SMSGRAB_SUPPLY_KEY;
const secret = process.env.SMSGRAB_SUPPLY_SECRET;
export async function signed(method, url, payload) {
const body = payload === undefined ? '' : JSON.stringify(payload);
const { pathname, search } = new URL(url);
const timestamp = String(Math.floor(Date.now() / 1000));
const nonce = randomBytes(18).toString('base64url');
const canonical = ['SGSUPPLY1', method, pathname, search.replace(/^\?/, ''), timestamp, nonce,
createHash('sha256').update(body).digest('hex')].join('\n');
return fetch(url, {
method,
body: body === '' ? undefined : body,
headers: {
'SmsGrab-Key': keyId,
'SmsGrab-Timestamp': timestamp,
'SmsGrab-Nonce': nonce,
'SmsGrab-Signature': `v1=${createHmac('sha256', secret).update(canonical).digest('hex')}`,
...(body === '' ? {} : { 'Content-Type': 'application/json' }),
},
});
}
await signed('POST', 'https://smsgrab.com/api/supply/v1/heartbeat', {
agent: 'my-gateway/1.0',
interval_seconds: 30,
ports: [{ port: '1', state: 'ready', signal_dbm: -71, operator: 'Turkcell' }],
});
PHP
function smsgrab_signed(string $method, string $url, ?array $payload = null): array
{
$body = $payload === null ? '' : json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR);
$parts = parse_url($url);
$timestamp = (string) time();
$nonce = rtrim(strtr(base64_encode(random_bytes(18)), '+/', '-_'), '=');
$canonical = implode("\n", ['SGSUPPLY1', $method, $parts['path'], $parts['query'] ?? '',
$timestamp, $nonce, hash('sha256', $body)]);
$headers = [
'SmsGrab-Key: '.getenv('SMSGRAB_SUPPLY_KEY'),
'SmsGrab-Timestamp: '.$timestamp,
'SmsGrab-Nonce: '.$nonce,
'SmsGrab-Signature: v1='.hash_hmac('sha256', $canonical, getenv('SMSGRAB_SUPPLY_SECRET')),
];
$curl = curl_init($url);
curl_setopt_array($curl, [CURLOPT_CUSTOMREQUEST => $method, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30]);
if ($body !== '') {
$headers[] = 'Content-Type: application/json';
curl_setopt($curl, CURLOPT_POSTFIELDS, $body);
}
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$response = (string) curl_exec($curl);
return ['status' => curl_getinfo($curl, CURLINFO_RESPONSE_CODE), 'body' => json_decode($response, true)];
}
smsgrab_signed('PUT', 'https://smsgrab.com/api/supply/v1/lines', ['lines' => [
['port' => '1', 'phone_e164' => '+905321112233', 'country_iso' => 'TR', 'operator' => 'Turkcell'],
]]);
curl
URL="https://smsgrab.com/api/supply/v1/messages"
BODY='{"messages":[{"id":"gw-7781","port":"1","from":"WhatsApp","text":"Your WhatsApp code: 123-456","received_at":"2026-11-28T10:00:00Z"}]}'
TS=$(date +%s)
NONCE=$(openssl rand -base64 18 | tr '+/' '-_' | tr -d '=')
REQUEST_PATH=$(printf '%s' "$URL" | sed -E 's#^https?://[^/]+##; s#\?.*$##')
BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 -hex | sed 's/^.* //')
SIGNATURE=$(printf 'SGSUPPLY1\nPOST\n%s\n\n%s\n%s\n%s' "$REQUEST_PATH" "$TS" "$NONCE" "$BODY_HASH" \
| openssl dgst -sha256 -hmac "$SMSGRAB_SUPPLY_SECRET" -hex | sed 's/^.* //')
curl -s -X POST "$URL" \
-H "SmsGrab-Key: $SMSGRAB_SUPPLY_KEY" \
-H "SmsGrab-Timestamp: $TS" \
-H "SmsGrab-Nonce: $NONCE" \
-H "SmsGrab-Signature: v1=$SIGNATURE" \
-H "Content-Type: application/json" \
-d "$BODY"
प्रमाणीकरण की हर समस्या 401 और कारण SUPPLY_SIGNATURE_INVALID लौटाती है, दोहराया nonce SUPPLY_NONCE_REUSED लौटाता है। बॉडी 256 KiB तक JSON हैं। हर कुंजी प्रति मिनट 600 अनुरोध भेज सकती है।
| एंडपॉइंट | यह क्या करता है |
|---|---|
GET/me |
आपका गेटवे, उसका पुष्टि मोड और दैनिक सीमा के मुकाबले आज की बिक्री |
POST/heartbeat |
हर पोर्ट की स्थिति बताता है और गेटवे को ऑनलाइन रखता है; अगला अंतराल लौटाता है |
PUT/lines |
512 तक पोर्ट उनके नंबरों और ऑपरेटरों के साथ रजिस्टर या अपडेट करता है |
DELETE/lines/{port} |
ऐसा पोर्ट हटाता है जिसमें अब SIM नहीं |
POST/lines/{port}/pause |
पोर्ट को रोकता है: यह रजिस्टर रहता है पर नई बिक्री नहीं लेता |
POST/lines/{port}/resume |
रुके हुए पोर्ट को फिर से बिक्री लेने देता है |
POST/messages |
100 तक आने वाले SMS भेजता है; हर संदेश ID एक बार स्वीकार होती है |
GET/assignments?wait=25&after={cursor} |
नए और बंद असाइनमेंट के लिए long-poll, 25 सेकंड तक खुला |
POST/assignments/{id}/ack |
पुष्टि करता है कि पोर्ट असाइनमेंट के लिए तैयार है |
POST/webhook/test |
आपके webhook पर टेस्ट इवेंट भेजता है और नतीजा बताता है |
जब कोई ग्राहक आपके किसी पोर्ट पर नंबर खरीदता है, हम असाइनमेंट खोलते हैं। गेटवे सेटिंग में चुनें कि वह इसकी पुष्टि कैसे करे।
Webhook
हम assignment.opened आपके URL पर POST करते हैं। 3 सेकंड में 2xx और {"ack":true} से जवाब दें।
Long-poll
आपका गेटवे GET /assignments खुला रखता है और हर मिले असाइनमेंट की पुष्टि करता है।
Heartbeat
तैयार पोर्ट के साथ ताज़ा heartbeat काफ़ी है। सरल सेटअप के लिए सबसे अच्छा।
हर webhook में SmsGrab-Signature: t=<unix time>,v1=<hex> होता है। "<t>.<raw body>" का HMAC-SHA256 अपने webhook सीक्रेट से निकालें, कॉन्स्टेंट टाइम में तुलना करें और पुराने टाइमस्टैम्प अस्वीकार करें। बंद होने के इवेंट 1, 5 और 15 मिनट और 1 घंटे बाद दोबारा भेजे जाते हैं।
{
"id": "evt_6f1c2a5e-9b0d-4a77-8a51-2d3e4f5a6b7c",
"type": "assignment.opened",
"created_at": "2026-11-28T10:00:00.000Z",
"data": {
"assignment": {
"id": "0b8e7c1a-4d2f-4e6a-9c3b-5a1d2e3f4a5b",
"port": "1",
"phone_e164": "+905321112233",
"service": { "id": "whatsapp", "name": "WhatsApp" },
"since": "2026-11-28T10:00:00.000Z",
"until": "2026-11-28T10:20:00.000Z"
}
}
}
PHP
$body = (string) file_get_contents('php://input');
parse_str(str_replace(',', '&', $_SERVER['HTTP_SMSGRAB_SIGNATURE'] ?? ''), $signature);
$timestamp = (string) ($signature['t'] ?? '');
$expected = hash_hmac('sha256', $timestamp.'.'.$body, getenv('SMSGRAB_SUPPLY_WEBHOOK_SECRET'));
if (! ctype_digit($timestamp) || abs(time() - (int) $timestamp) > 300
|| ! hash_equals($expected, (string) ($signature['v1'] ?? ''))) {
http_response_code(401);
exit;
}
$event = json_decode($body, true, 32, JSON_THROW_ON_ERROR);
if ($event['type'] === 'assignment.opened') {
remember_assignment($event['data']['assignment']);
}
header('Content-Type: application/json');
echo json_encode(['ack' => true]);
Python
import hashlib, hmac, os, time
from flask import Flask, abort, jsonify, request
app = Flask(__name__)
SECRET = os.environ["SMSGRAB_SUPPLY_WEBHOOK_SECRET"].encode()
@app.post("/smsgrab")
def smsgrab():
header = request.headers.get("SmsGrab-Signature", "")
signature = dict(item.split("=", 1) for item in header.split(",") if "=" in item)
timestamp = signature.get("t", "")
expected = hmac.new(SECRET, timestamp.encode() + b"." + request.get_data(), hashlib.sha256).hexdigest()
if not timestamp.isdigit() or abs(time.time() - int(timestamp)) > 300 \
or not hmac.compare_digest(expected, signature.get("v1", "")):
abort(401)
event = request.get_json()
if event["type"] == "assignment.opened":
remember_assignment(event["data"]["assignment"])
return jsonify(ack=True)
Node.js
import express from 'express';
import { createHmac, timingSafeEqual } from 'node:crypto';
const app = express();
const secret = process.env.SMSGRAB_SUPPLY_WEBHOOK_SECRET;
app.post('/smsgrab', express.raw({ type: 'application/json' }), (req, res) => {
const signature = Object.fromEntries((req.get('SmsGrab-Signature') ?? '').split(',').map((item) => item.split('=', 2)));
const timestamp = Number(signature.t);
const expected = Buffer.from(createHmac('sha256', secret).update(`${signature.t}.${req.body}`).digest('hex'));
const received = Buffer.from(signature.v1 ?? '');
if (!Number.isInteger(timestamp) || Math.abs(Date.now() / 1000 - timestamp) > 300
|| received.length !== expected.length || !timingSafeEqual(received, expected)) {
return res.sendStatus(401);
}
const event = JSON.parse(req.body);
if (event.type === 'assignment.opened') {
rememberAssignment(event.data.assignment);
}
return res.json({ ack: true });
});
रजिस्टर लाइन तभी बिकती है जब साबित करे कि वह SMS पाती है। डैशबोर्ड में पुष्टि कोड माँगें और 15 मिनट के भीतर लाइन पर कोई भी SMS भेजें जिसमें वह कोड हो। संदेश सिर्फ़ जाँच के लिए इस्तेमाल होता है और कभी संग्रहित नहीं होता।
GoIP गेटवे बिना अतिरिक्त सॉफ़्टवेयर के SMS को URL पर फ़ॉरवर्ड कर सकते हैं।
आपका inbound URL ऐसा दिखता है
https://smsgrab.com/api/supply/v1/inbound/goip/YOUR-PRIVATE-TOKEN
आपके SIM वाला कोई भी Android फ़ोन
कोई भी SMS फ़ॉरवर्डर ऐप, Tasker, MacroDroid या iOS Shortcuts
अपने SIM या eSIM कोड भेजें, हम होस्ट करते हैं