Unified Messaging Gateway is an all-in-one platform for sending and managing SMS, WhatsApp, and Email messages. It offers a single API and dashboard for seamless communication, making it easy to handle alerts, marketing, and customer support across multiple channels
Project description
Softlink SMS SDK
A Python SDK for Softlink's SMS Gateway - a reliable and efficient platform for sending SMS messages in Kenya and beyond. This SDK provides a simple interface to integrate Softlink's SMS services into your Python applications.
Overview
Softlink SMS Gateway is a leading provider of SMS services in Kenya, offering:
- High delivery rates
- Real-time delivery reports
- Competitive pricing
- 24/7 support
- Reliable infrastructure
Features
- Send individual and bulk SMS messages
- Flexible configuration options
- Comprehensive error handling
- Type hints for better IDE support
- Simple and intuitive API
- Real-time delivery status
- Support for all Kenyan mobile networks
Installation
pip install softlink
Configuration
You can configure the SMS client in two ways:
1. Using Environment Variables
Set the following environment variable:
export SOFTLINK_SMS_API_KEY='your_consumer_key'
2. Using Direct Configuration
from softlink import SMSConfig
# Using consumer key
config = SMSConfig(
consumer_key='your_consumer_key'
)
# Or use default configuration from environment
config = SMSConfig()
Usage
Basic Usage
from softlink import SMSClient
# Using environment variables
client = SMSClient()
# Send SMS
results = client.send_sms({
"message": "Jambo Kenya",
"recipients": ["+254713164545"]
})
With Custom Configuration
from softlink import SMSClient, SMSConfig
# Using consumer key
config = SMSConfig(
consumer_key='your_consumer_key'
)
client = SMSClient(config)
Error Handling
The library provides a comprehensive set of exceptions for better error handling:
from softlink import (
SMSClient,
SoftlinkException,
APIError,
APIConnectionError,
AuthenticationError,
InvalidRequestError,
RateLimitError,
SMSError,
SMSDeliveryError,
SMSValidationError,
SMSQuotaError
)
try:
client = SMSClient()
results = client.send_sms({
"message": "Jambo Kenya",
"recipients": ["+254713164545"]
})
except AuthenticationError as e:
print(f"Authentication failed: {e}")
except SMSValidationError as e:
print(f"Invalid input: {e}")
except SMSDeliveryError as e:
print(f"Message delivery failed: {e}")
except SMSQuotaError as e:
print(f"Quota exceeded: {e}")
except RateLimitError as e:
print(f"Rate limit exceeded: {e}")
except APIConnectionError as e:
print(f"Network error: {e}")
except APIError as e:
print(f"API error: {e}")
except SoftlinkException as e:
print(f"General error: {e}")
Available Exceptions
SoftlinkException: Base exception class for all SDK exceptionsAPIError: Raised when the API returns an error responseAPIConnectionError: Raised when network communication failsAuthenticationError: Raised when authentication failsInvalidRequestError: Raised when invalid parameters are passedRateLimitError: Raised when too many requests are madeSMSError: Base exception for SMS-specific errorsSMSDeliveryError: Raised when SMS delivery failsSMSValidationError: Raised when SMS validation failsSMSQuotaError: Raised when SMS quota is exceeded
API Reference
SMSClient
__init__(config: Optional[SMSConfig] = None)
Initialize the SMS client with configuration.
send_sms(payload: dict) -> dict
Send SMS messages to recipients.
Parameters:
payload(dict): Dictionary containing:message(str): The message contentrecipients(List[str]): List of recipient phone numbers in E.164 format (e.g., +254713164545)
Returns:
dict: Response from the API containing message status and details
SMSConfig
Configuration class for managing API credentials.
Parameters:
consumer_key(Optional[str]): Consumer key for authentication. If not provided, will try to load from environment variable SOFTLINK_SMS_API_KEY
Best Practices
-
Phone Number Format
- Always use E.164 format (e.g., +254713164545)
- Include country code
- Remove any spaces or special characters
-
Message Content
- Keep messages concise
- Avoid special characters
- Test messages before bulk sending
-
Error Handling
- Always implement proper error handling
- Log errors for debugging
- Implement retry logic for failed messages
- Handle rate limits appropriately
Support
For support, please contact:
- Email: softwareproviders69@gmail.com
- Phone: +254 713 164 545
- Website: https://softlinksms.co.ke
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file softlink-0.1.5.tar.gz.
File metadata
- Download URL: softlink-0.1.5.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4250e13a8452eac13b89e998511ebe6e71b42066c531e7c8e47c02a32fa9db0
|
|
| MD5 |
4e44e66fc7b537dd8e37e29dda2b35ad
|
|
| BLAKE2b-256 |
a9ffa08191e759c77d08f81a38341013c422caf809b4491e81c1ff15b202a55e
|
Provenance
The following attestation bundles were made for softlink-0.1.5.tar.gz:
Publisher:
python-publish.yml on thaka-creations/softlink
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
softlink-0.1.5.tar.gz -
Subject digest:
d4250e13a8452eac13b89e998511ebe6e71b42066c531e7c8e47c02a32fa9db0 - Sigstore transparency entry: 212315854
- Sigstore integration time:
-
Permalink:
thaka-creations/softlink@f044b5620b2c0041e7094dabf00827e50dea0afd -
Branch / Tag:
refs/tags/0.1.5 - Owner: https://github.com/thaka-creations
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f044b5620b2c0041e7094dabf00827e50dea0afd -
Trigger Event:
push
-
Statement type:
File details
Details for the file softlink-0.1.5-py3-none-any.whl.
File metadata
- Download URL: softlink-0.1.5-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb1f7f289e78fddc82814735b657b3814abf316cc2b7cb0a74135eb3ab8ffebf
|
|
| MD5 |
dc7dc5b574ffe80eb921c6ba4ab6eaca
|
|
| BLAKE2b-256 |
ef6fa53e5c947d534f22514f4df65bea7373dde0f78b5a399bd03a6b1f5a5926
|
Provenance
The following attestation bundles were made for softlink-0.1.5-py3-none-any.whl:
Publisher:
python-publish.yml on thaka-creations/softlink
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
softlink-0.1.5-py3-none-any.whl -
Subject digest:
bb1f7f289e78fddc82814735b657b3814abf316cc2b7cb0a74135eb3ab8ffebf - Sigstore transparency entry: 212315856
- Sigstore integration time:
-
Permalink:
thaka-creations/softlink@f044b5620b2c0041e7094dabf00827e50dea0afd -
Branch / Tag:
refs/tags/0.1.5 - Owner: https://github.com/thaka-creations
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f044b5620b2c0041e7094dabf00827e50dea0afd -
Trigger Event:
push
-
Statement type: