Swift SMS

ERPNext integration guide

How to plug Swift SMS into ERPNext as the SMS/OTP backend for a sender-specific API key.

Server-side only Per sender key Works with scripts

Recommended flow

  1. Create one sender ID in Swift SMS for the ERPNext business.
  2. Copy the sender-specific API key from the Swift SMS dashboard.
  3. Store that key in an ERPNext custom field, password field, or server script variable.
  4. Call send_sms.php or send_otp.php from ERPNext server-side code.
  5. If you rotate the sender key, update ERPNext immediately.

SMS example

import requests

url = "https://sms.brillsinnovation.com/send_sms.php"
headers = {
    "Content-Type": "application/json",
    "X-Sender-Key": "sx_your_sender_key"
}
payload = {
    "to": "0540519119",
    "message": "Invoice INV-001 has been paid.",
    "sender_id": "TESTSMS"
}

response = requests.post(url, json=payload, headers=headers, timeout=30)
print(response.status_code)
print(response.json())

OTP example

import requests

url = "https://sms.brillsinnovation.com/send_otp.php"
headers = {
    "Content-Type": "application/json",
    "X-Sender-Key": "sx_your_sender_key"
}
payload = {
    "phone": "0540519119",
    "pin_length": 6,
    "expiry_amount": 10,
    "expiry_duration": "minutes",
    "sender_id": "TESTSMS"
}

response = requests.post(url, json=payload, headers=headers, timeout=30)
print(response.status_code)
print(response.json())

What to store in ERPNext

  • Sender ID used by the business.
  • Sender API key for that sender ID.
  • Optional label like Billing or OTP.
  • Whether the sender is primary or not.

Verification endpoint

If you use OTP flows inside ERPNext, you can verify codes server-side after the user enters them.

POST https://sms.brillsinnovation.com/verify_otp.phpHeaders:
  Content-Type: application/json
  X-Sender-Key: sx_your_sender_key

Body:
{
  "phone": "0540519119",
  "code": "243714"
}

Implementation advice

  • Do not expose the sender key in browser-side JavaScript.
  • Use an ERPNext server script or custom app method instead of a public endpoint.
  • Log request IDs returned by Swift SMS for reconciliation.
  • When the sender key changes, treat it like a password reset and rotate immediately.