LanguageGuide · official SDK soon
Send SMS in Tunisia from Go with net/http.
Go's standard library is enough: net/http for the call, encoding/json for the response. No external module. The official Go library is on its way.
What it does
- Standard library only.
- Timeout set on the HTTP client.
- Response decoded into a typed struct.
- Honor the Retry-After header if you get a 429 rate_limited.
Setup
- 1Put your API key in the SENDIMO_API_KEY environment variable.
- 2Build the POST request to /v1/messages with net/http.
- 3Read the 202 response into a Message struct.
- 4Receive delivery statuses by webhook.
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"time"
)
type Message struct {
ID string `json:"id"`
Status string `json:"status"`
}
func main() {
payload, _ := json.Marshal(map[string]string{
"to": "+21620123456",
"from": "SENDIMO",
"text": "Your code is 482913. It expires in 5 minutes.",
"reference": "order-4821",
})
req, _ := http.NewRequest(http.MethodPost, "https://api.sendimo.tn/v1/messages", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("SENDIMO_API_KEY"))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", "order-4821-otp")
client := &http.Client{Timeout: 10 * time.Second}
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var msg Message
json.NewDecoder(resp.Body).Decode(&msg)
fmt.Println(resp.StatusCode, msg.ID, msg.Status) // 202 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
PythonLanguage
Send SMS in Tunisia from Python with the Sendimo API.
View integrationPHPLanguage
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 integration