GSM SMS API

GSM API

Send Broadcast

Endpoint

POST https://wa20.nuke.co.in/webhook/api/addbroadcastgsm.php

You can send a broadcast in two ways:

ModeContent-TypeUse when
JSONapplication/jsonUp to 50,000 contacts per request.
CSVmultipart/form-dataLarge lists, or when each contact has its own variables.

Authentication

Send a JWT in one of these ways:

MethodExample
HeaderAuthorization: Bearer <jwt_token>
Cookieauth_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

ParameterTypeRequiredDescription
usernamestringNo*Your account username. Only needed if not sending a JWT. *One of username or a valid JWT is required.
broadcast_namestringYesAny label for this broadcast (max 100 characters, trimmed if longer).
brodcast_servicestringYesRoute/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.
contactsarrayYesUp 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.
messagestringYesThe SMS text. May contain {{variable}} placeholders (see Variables).
providermessageidstringNoOptional 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

FieldDescription
request_idUnique ID for this broadcast: your providermessageid or an auto-generated GSMCAMP_... ID. Use this to track delivery later.
statusPending means the request was accepted and queued for sending.
message"Success" if the request was accepted.
urlStatic value, always "1".
usernameThe username the broadcast was sent under.
CreditsTotal credits deducted for this broadcast (sum of the per-message cost of every queued contact).
pending_countContacts accepted and queued for sending.
insufficient_countContacts saved with status Insufficient because your balance did not cover them. They are not sent and not charged.
skipped_too_longContacts 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

FieldTypeRequiredDescription
csv / filefileYesThe CSV file (first row must be the header).
broadcast_namestringYesLabel for this broadcast.
brodcast_servicestringYesRoute/service, same as JSON mode.
messagestringYesSMS text, may contain {{variable}} placeholders.
usernamestringNo*Only needed if not sending a JWT.
providermessageidstringNoOptional custom request ID.

CSV format

  • The header row must contain one number column named number, mobile, mobile_number, phone or phone_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

FieldDescription
request_idUnique ID for this broadcast.
statusPending = accepted.
total_recordsValid rows found in the CSV.
processed_recordsRows saved (excludes rows skipped for being too long).
pending_recordsRows queued for sending.
insufficient_recordsRows saved as Insufficient (balance ran out). Not sent, not charged.
skipped_too_longRows skipped because the personalized message was too long.
credits_usedTotal 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 header Due Date is used as {{due_date}}, and {{ Name }} matches name.
  • 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 LengthCredits per contact
Up to 160 chars1
161–306 chars2
307–459 chars3
460–612 chars4
Over 612 charsSkipped, "Message is too long"

Unicode messages:

Message LengthCredits per contact
Up to 70 chars1
71–133 chars2
134–199 chars3
200–265 chars4
266–331 chars5
Over 331 charsSkipped, "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_service and message are always required. contacts is 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

StatusMessageReason
405Method not allowedRequest method is not POST.
401Invalid Authorization tokenNo valid JWT and no username in body.
429Too many requests. Please try again later.Rate limit exceeded.
400broadcast_name, brodcast_service, contacts, and message are requiredJSON mode: a required field is missing.
400broadcast_name, brodcast_service, and message are requiredCSV mode: a required field is missing.
400Each contact number must be between 9 and 30 digitsJSON mode: a number is too short or too long after cleanup.
400Maximum 50000 contacts allowed per request. Please split the campaign or use CSV upload.JSON mode: too many contacts.
400No valid contact numbers foundJSON mode: no usable numbers in contacts.
400Failed to upload CSV file / Unable to open uploaded CSV fileCSV upload failed or is unreadable.
400CSV file is emptyCSV has no header row.
400CSV must contain a valid number column (number, mobile, mobile_number, phone, phone_number)CSV header has no number column.
400No valid contact numbers found in CSV fileCSV has no valid rows.
400Message is too longEvery contact's final message exceeds the maximum length for its encoding.
500Something 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