LanguageGuide · official SDK soon
Send SMS in Tunisia from Python with the Sendimo API.
With the requests library, one HTTP call sends an SMS from your scripts or your Django, Flask or FastAPI apps. The official Python SDK is on its way; the code below works today.
What it does
- OTP codes, order confirmations and alerts.
- Bulk sending, up to 10,000 SMS per call with POST /messages/bulk.
- sk_test_ test key: realistic responses, nothing is sent or charged.
- Idempotency-Key header to retry without ever sending twice.
Setup
- 1Install requests: pip install requests
- 2Create an API key in your Sendimo workspace and export it as SENDIMO_API_KEY.
- 3POST to /v1/messages: the 202 response contains the message ID.
- 4Receive the final status (delivered, failed…) by webhook.
import os
import requests
response = requests.post(
"https://api.sendimo.tn/v1/messages",
headers={
"Authorization": f"Bearer {os.environ['SENDIMO_API_KEY']}",
"Idempotency-Key": "order-4821-otp",
},
json={
"to": "+21620123456",
"from": "SENDIMO",
"text": "Your code is 482913. It expires in 5 minutes.",
"reference": "order-4821",
},
timeout=10,
)
response.raise_for_status() # 4xx/5xx → exception, see error.code
message = response.json()
print(message["id"], message["status"]) # msg_01HF8Z3K9QX2 queued{
"id": "msg_01HF8Z3K9QX2",
"status": "queued",
"to": "+21620123456",
"from": "SENDIMO",
"text": "Your code is 482913. It expires in 5 minutes.",
"encoding": "GSM-7",
"segments": 1,
"network": "ooredoo",
"cost": { "amount": "0.140", "currency": "TND" },
"reference": "order-4821",
"scheduled_at": null,
"created_at": "2026-10-30T09:15:00Z"
}Next steps
Other integrations
PHPLanguage
Send SMS in Tunisia from PHP, with no dependency.
View integrationLaravelPHP framework
Send SMS in Tunisia from Laravel with the built-in HTTP client.
View integrationJavaScript / Node.jsLanguage
Send SMS in Tunisia from Node.js with fetch.
View integrationJavaLanguage
Send SMS in Tunisia from Java, with no dependency.
View integrationSpring BootJava framework
Send SMS in Tunisia from Spring Boot with RestClient.
View integrationGoLanguage
Send SMS in Tunisia from Go with net/http.
View integration