GSM API
Send Broadcast
Endpoint
POST https://wa20.nuke.co.in/webhook/api/addbroadcastgsm.php
You can send a broadcast in two ways:
| Mode | Content-Type | Use when |
|---|---|---|
| JSON | application/json | Up to 50,000 contacts per request. |
| CSV | multipart/form-data | Large lists, or when each contact has its own variables. |
Authentication
Send a JWT in one of these ways:
| Method | Example |
|---|---|
| Header | Authorization: Bearer <jwt_token> |
| Cookie | auth_token=<jwt_token> |
Alternatively, you can pass username directly in the request body (JSON or form field). If present, it is used instead of the JWT.
Mode 1: JSON
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
username | string | No* | Your account username. Only needed if not sending a JWT. *One of username or a valid JWT is required. |
broadcast_name | string | Yes | Any label for this broadcast (max 100 characters, trimmed if longer). |
brodcast_service | string | Yes | Route/service to send through, used as the SMS route (e.g. sms_credits). (Note: this parameter name is spelled without the "a". Keep it as-is.) broadcast_service is also accepted. |
contacts | array | Yes | Up to 50,000 entries. Each entry is either a phone number string, or an object with a number and variables (see below). Non-digit characters (+, spaces, -) are stripped automatically. |
message | string | Yes | The SMS text. May contain {{variable}} placeholders (see Variables). |
providermessageid | string | No | Optional custom ID for this request. Also accepts provider_message_id or providerMessageId. If not given, one is auto-generated as GSMCAMP_YYYYMMDD_XXXXXX. |
Contact formats
Plain numbers:
"contacts": ["919912345678", "918812345678"]
Objects with variables:
"contacts": [
{ "number": "919912345678", "name": "Ravi", "amount": "500" },
{ "number": "918812345678", "name": "Priya", "amount": "750" }
]
You can also group variables under a variables key:
{ "number": "919912345678", "variables": { "name": "Ravi", "amount": "500" } }
The number key can be number, mobile, mobile_number, phone or phone_number. You can mix plain numbers and objects in the same array.
Example Request
POST https://{{url}}/webhook/api/addbroadcastgsm.php
Authorization: Bearer eyJhbGciOi...
Content-Type: application/json
{
"broadcast_name": "anything",
"brodcast_service": "sms_credits",
"contacts": [
{ "number": "919912345678", "name": "Ravi", "amount": "500" },
{ "number": "918812345678", "name": "Priya", "amount": "750" }
],
"message": "Hi {{name}}, Rs {{amount}} is due. Please pay today."
}
cURL Example
curl -X POST "https://{{url}}/webhook/api/addbroadcastgsm.php" \
-H "Authorization: Bearer eyJhbGciOi..." \
-H "Content-Type: application/json" \
-d '{
"broadcast_name": "anything",
"brodcast_service": "sms_credits",
"contacts": [
{"number": "919912345678", "name": "Ravi", "amount": "500"},
{"number": "918812345678", "name": "Priya", "amount": "750"}
],
"message": "Hi {{name}}, Rs {{amount}} is due. Please pay today."
}'
Example Response: 200 OK
{
"request_id": "GSMCAMP_20260711_138476",
"status": "Pending",
"message": "Success",
"url": "1",
"username": "yourusername",
"Credits": 2,
"pending_count": 2,
"insufficient_count": 0,
"skipped_too_long": 0
}
Response Fields
| Field | Description |
|---|---|
request_id | Unique ID for this broadcast: your providermessageid or an auto-generated GSMCAMP_... ID. Use this to track delivery later. |
status | Pending means the request was accepted and queued for sending. |
message | "Success" if the request was accepted. |
url | Static value, always "1". |
username | The username the broadcast was sent under. |
Credits | Total credits deducted for this broadcast (sum of the per-message cost of every queued contact). |
pending_count | Contacts accepted and queued for sending. |
insufficient_count | Contacts saved with status Insufficient because your balance did not cover them. They are not sent and not charged. |
skipped_too_long | Contacts skipped because their personalized message exceeded the maximum length. Not saved, not charged. |
Mode 2: CSV Upload
Send the CSV as a file in a multipart/form-data request. The file field name is csv (or file).
Form fields
| Field | Type | Required | Description |
|---|---|---|---|
csv / file | file | Yes | The CSV file (first row must be the header). |
broadcast_name | string | Yes | Label for this broadcast. |
brodcast_service | string | Yes | Route/service, same as JSON mode. |
message | string | Yes | SMS text, may contain {{variable}} placeholders. |
username | string | No* | Only needed if not sending a JWT. |
providermessageid | string | No | Optional custom request ID. |
CSV format
- The header row must contain one number column named
number,mobile,mobile_number,phoneorphone_number(case-insensitive). - Every other column becomes a variable, named after its header.
- Rows with a missing, too short (under 9 digits) or too long (over 30 digits) number are silently skipped.
- Empty rows are ignored.
number,name,amount,due date
919912345678,Ravi,500,25 Nov
918812345678,Priya,750,26 Nov
cURL Example
curl -X POST "https://{{url}}/webhook/api/addbroadcastgsm.php" \
-H "Authorization: Bearer eyJhbGciOi..." \
-F "broadcast_name=anything" \
-F "brodcast_service=sms_credits" \
-F "message=Hi {{name}}, Rs {{amount}} is due on {{due_date}}." \
-F "[email protected]"
Example Response: 200 OK
{
"request_id": "GSMCAMP_20260711_138477",
"status": "Pending",
"message": "Success",
"total_records": 2,
"processed_records": 2,
"pending_records": 2,
"insufficient_records": 0,
"skipped_too_long": 0,
"credits_used": 2
}
CSV Response Fields
| Field | Description |
|---|---|
request_id | Unique ID for this broadcast. |
status | Pending = accepted. |
total_records | Valid rows found in the CSV. |
processed_records | Rows saved (excludes rows skipped for being too long). |
pending_records | Rows queued for sending. |
insufficient_records | Rows saved as Insufficient (balance ran out). Not sent, not charged. |
skipped_too_long | Rows skipped because the personalized message was too long. |
credits_used | Total credits deducted. |
Variables
Use {{variable_name}} anywhere in message. Each contact receives its own personalized text.
- In CSV mode, variables are the column headers. In JSON mode, they are the extra keys on each contact object.
- Names are case-insensitive, and spaces or symbols become
_. For example, the headerDue Dateis used as{{due_date}}, and{{ Name }}matchesname. - If a contact has no value for a variable, it is replaced with an empty string.
- Credits are calculated per contact, on the final personalized message, so a long name can move one contact into the next pricing tier.
- The
{{name}}placeholder works the same way as any other variable.
How Credits Are Calculated
Cost depends on message length and whether the message contains Unicode characters (e.g. emojis, non-English scripts). Length is measured on the final message after variables are filled in.
Plain (GSM 7-bit) messages:
| Message Length | Credits per contact |
|---|---|
| Up to 160 chars | 1 |
| 161–306 chars | 2 |
| 307–459 chars | 3 |
| 460–612 chars | 4 |
| Over 612 chars | Skipped, "Message is too long" |
Unicode messages:
| Message Length | Credits per contact |
|---|---|
| Up to 70 chars | 1 |
| 71–133 chars | 2 |
| 134–199 chars | 3 |
| 200–265 chars | 4 |
| 266–331 chars | 5 |
| Over 331 chars | Skipped, "Message is too long" |
Total deduction = sum of each queued contact's credits.
Insufficient balance: the request is no longer rejected. Contacts are processed in order; those your balance covers are queued as Pending, and the remaining contacts are saved with status Insufficient (not sent, not charged). Check pending_count / insufficient_count (or pending_records / insufficient_records for CSV) in the response.
Validation Rules
broadcast_name,brodcast_serviceandmessageare always required.contactsis required in JSON mode and the CSV file in CSV mode.- JSON mode: each number must be 9 to 30 digits after stripping non-numeric characters. Any number outside this range fails the entire request with a
400. Maximum 50,000 contacts per request. - CSV mode: invalid rows are skipped instead of failing the request.
- Requests are rate-limited to 120 per second per username + IP combination. Exceeding this returns a
429.
Error Responses
| Status | Message | Reason |
|---|---|---|
| 405 | Method not allowed | Request method is not POST. |
| 401 | Invalid Authorization token | No valid JWT and no username in body. |
| 429 | Too many requests. Please try again later. | Rate limit exceeded. |
| 400 | broadcast_name, brodcast_service, contacts, and message are required | JSON mode: a required field is missing. |
| 400 | broadcast_name, brodcast_service, and message are required | CSV mode: a required field is missing. |
| 400 | Each contact number must be between 9 and 30 digits | JSON mode: a number is too short or too long after cleanup. |
| 400 | Maximum 50000 contacts allowed per request. Please split the campaign or use CSV upload. | JSON mode: too many contacts. |
| 400 | No valid contact numbers found | JSON mode: no usable numbers in contacts. |
| 400 | Failed to upload CSV file / Unable to open uploaded CSV file | CSV upload failed or is unreadable. |
| 400 | CSV file is empty | CSV has no header row. |
| 400 | CSV must contain a valid number column (number, mobile, mobile_number, phone, phone_number) | CSV header has no number column. |
| 400 | No valid contact numbers found in CSV file | CSV has no valid rows. |
| 400 | Message is too long | Every contact's final message exceeds the maximum length for its encoding. |
| 500 | Something went wrong. Please try again later. | Server/database error. |
GET/HTTP API
https://{{url}}/v5/api/sms_get.php?username=username&password=123456&message=Hello&number=91123456
(Unchanged. No updated backend code was provided for this endpoint.)
For reporting setup, webhook. Check the link to setup the webhook https://autobotchat.readme.io/reference/report-webhook
