Skip to main content

BudgetSMS Worker

Send SMS messages through the BudgetSMS service with support for test mode.

Installation

import '@unchainedshop/plugins/worker/budgetsms';

Environment Variables

VariableDescription
BUDGETSMS_USERNAMEYour BudgetSMS username (alphanumeric)
BUDGETSMS_USERIDYour BudgetSMS user ID (numeric only)
BUDGETSMS_HANDLEYour BudgetSMS API handle (alphanumeric)
UserID Must Be Numeric

The BUDGETSMS_USERID must contain only numbers. You can find it in your BudgetSMS control panel after login.

Usage

Send Real SMS

mutation SendSMS {
createWork(
type: "BUDGETSMS"
input: {
to: "+41791234567"
text: "Your verification code is 123456"
from: "YourCompany"
price: true # Include price info in response
credit: true # Include remaining credit in response
}
) {
_id
status
}
}

Test Mode (No Credit Deducted)

mutation TestSMS {
createWork(
type: "BUDGETSMS"
input: {
to: "+41791234567"
text: "Test message"
from: "YourCompany"
test: true
}
) {
_id
status
}
}

Input Parameters

ParameterTypeDefaultDescription
toString-Phone number in international format (required)
textString-SMS message content
fromString-Sender name (max 11 alphanumeric or 16 numeric chars)
testBooleanfalseUse test endpoint (no credit deducted)
customidString-Custom ID for tracking
priceBooleanfalseInclude price info in response
mccmncBooleanfalseInclude carrier info in response
creditBooleanfalseInclude remaining credit in response

Result

Success

{
"sms_id": "123456789",
"status": "sent",
"test_mode": false,
"price": 0.05,
"parts": 1,
"remaining_credit": 99.95
}

Test Mode Success

{
"sms_id": "123456789",
"status": "test_successful",
"test_mode": true,
"message": "Test SMS validated successfully (no credit deducted)"
}

Error Codes

CodeDescription
1001Authentication failed OR insufficient credit
1002Account not active
1003Insufficient credit
2001SMS message text is empty
2005Destination number too short
2012SMS message text too long
Error 1001 Ambiguity

BudgetSMS returns error 1001 for both authentication failures AND when you have zero credit. Use the test endpoint to distinguish between these cases.

Adapter Details

PropertyValue
Keyshop.unchained.worker-plugin.budgetsms
TypeBUDGETSMS
Sourceworker/budgetsms.ts

External Resources