Bridge API DocsBridge API Docs
Bridge API Docs
Api reference

Send SMS

Send SMS messages to customers

Send SMS

Send SMS messages to customers for verification codes, transaction notifications, or promotional messages.

Endpoint

POST https://api.bridgeagw.com/send_sms

Request Headers

Authorization: Basic <base64_encoded_credentials>
Content-Type: application/json

Request Body

{
  "service_id": 1,
  "customer_number": "0541234567",
  "msg_body": "Verification code: 091878",
  "sender_id": "MMDA"
}

Parameters

ParameterTypeRequiredDescription
service_idintegerYesYour service identifier
customer_numberstringYesRecipient's phone number
msg_bodystringYesSMS message content
sender_idstringYesSender identifier (max 11 characters)

Response

Success Response (200)

{
  "response_message": "SMS request has been received for processing",
  "response_code": "370"
}

Example Usage

cURL

curl -X POST "https://api.bridgeagw.com/send_sms" \
  -H "Authorization: Basic <your_credentials>" \
  -H "Content-Type: application/json" \
  -d '{
    "service_id": 1,
    "customer_number": "0541234567",
    "msg_body": "Verification code: 091878",
    "sender_id": "MMDA"
  }'

JavaScript

const response = await fetch('https://api.bridgeagw.com/send_sms', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic <your_credentials>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    service_id: 1,
    customer_number: "0541234567",
    msg_body: "Verification code: 091878",
    sender_id: "MMDA"
  })
});

const result = await response.json();
console.log(result);

Python

import requests

url = "https://api.bridgeagw.com/send_sms"
headers = {
    "Authorization": "Basic <your_credentials>",
    "Content-Type": "application/json"
}
data = {
    "service_id": 1,
    "customer_number": "0541234567",
    "msg_body": "Verification code: 091878",
    "sender_id": "MMDA"
}

response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)

Use Cases

Verification Codes

Send OTP or verification codes to customers:

const verificationCode = generateOTP();
await sendSMS({
  customer_number: customerPhone,
  msg_body: `Your verification code is: ${verificationCode}`,
  sender_id: "YOURAPP"
});

Transaction Notifications

Notify customers about transaction status:

await sendSMS({
  customer_number: customerPhone,
  msg_body: `Payment of GHS ${amount} received successfully. Transaction ID: ${transactionId}`,
  sender_id: "PAYMENT"
});

Promotional Messages

Send promotional or informational messages:

await sendSMS({
  customer_number: customerPhone,
  msg_body: "Welcome to our service! Get 10% off your first transaction.",
  sender_id: "PROMO"
});

SMS Guidelines

Message Content

  • Keep messages concise and clear
  • Include relevant information (amounts, transaction IDs, etc.)
  • Avoid spam-like content
  • Use appropriate language for your audience

Sender ID

  • Maximum 11 characters
  • Use your brand name or service identifier
  • Must be approved by your account manager
  • Examples: "YOURAPP", "PAYMENT", "VERIFY"

Phone Number Format

  • Include country code (e.g., "0541234567" for Ghana)
  • Remove any special characters or spaces
  • Ensure the number is valid and active

Error Handling

Common error responses include:

{
  "response_message": "Invalid phone number",
  "response_code": "400"
}
{
  "response_message": "Insufficient SMS balance",
  "response_code": "402"
}
{
  "response_message": "Invalid sender ID",
  "response_code": "403"
}

SMS Balance

SMS messages are deducted from your SMS balance. You can check your balance using the Get Account Balance endpoint.

Delivery Status

SMS delivery is handled asynchronously. The API returns immediately with a confirmation that the SMS has been queued for delivery. Delivery status can be tracked through:

  1. Webhooks: Set up webhooks to receive delivery confirmations
  2. Status API: Check delivery status using transaction IDs
  3. Dashboard: Monitor SMS delivery through your client portal

Best Practices

  1. Rate Limiting: Don't send too many SMS messages in a short period
  2. Content: Keep messages relevant and valuable to recipients
  3. Timing: Send messages at appropriate times for your audience
  4. Testing: Test SMS functionality with your own number first
  5. Compliance: Ensure compliance with local SMS regulations

Notes

  • SMS messages are processed asynchronously
  • Delivery time depends on the recipient's network
  • International SMS may have additional charges
  • Some networks may have delivery delays
  • SMS balance is separate from payment balances