KambaSMS / SDKs

Integra com a stack que já utilizas.

Exemplos HTTP para o teu servidor. As versões e a compatibilidade dos SDKs estão em revisão; estes exemplos não exigem instalar um pacote KambaSMS.

HTTP

Node.js / TypeScript

Node.js 22+ (.mjs)

GET /credits/balance

Exemplo inicial

$const key = process.env.KAMBA_API_KEY;›if (!key) throw new Error('API key required');›const response = await fetch('https://api.kambasms.ao/credits/balance', {› headers: { 'X-API-Key': key }, redirect: 'error',› signal: AbortSignal.timeout(10000)›});›if (!response.ok) throw new Error('API request failed');
HTTP

Python

Python 3.8+ / standard library

GET /credits/balance

Exemplo inicial

$import http.client, os›conn = http.client.HTTPSConnection("api.kambasms.ao", timeout=10)›conn.request("GET", "/credits/balance", headers={› "X-API-Key": os.environ["KAMBA_API_KEY"]›})›response = conn.getresponse()›if response.status != 200: raise RuntimeError("API request failed")›conn.close()
HTTP

PHP

PHP 8.0+ / cURL

GET /credits/balance

Exemplo inicial

$$key = getenv('KAMBA_API_KEY');›if (!$key) throw new RuntimeException('API key required');›$ch = curl_init('https://api.kambasms.ao/credits/balance');›curl_setopt_array($ch, [CURLOPT_HTTPHEADER => ['X-API-Key: '.$key],› CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => false,› CURLOPT_TIMEOUT => 10]);›$body = curl_exec($ch);›$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);›curl_close($ch);›if ($body === false || $status !== 200) throw new RuntimeException('API request failed');
HTTP

C# / .NET

.NET 8.0+

GET /credits/balance

Exemplo inicial

$using var handler = new HttpClientHandler { AllowAutoRedirect = false };›using var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(10) };›var key = Environment.GetEnvironmentVariable("KAMBA_API_KEY")› ?? throw new InvalidOperationException("API key required");›client.DefaultRequestHeaders.Add("X-API-Key", key);›using var response = await client.GetAsync("https://api.kambasms.ao/credits/balance");›response.EnsureSuccessStatusCode();

A mesma API, sintaxe familiar.

Os exemplos consultam saldo sem enviar mensagens. Mantém as chaves no teu servidor, define timeouts e consulta o contrato API antes de implementar envios.

Chave API nos headers do servidor
Exemplos de consulta de saldo, só leitura
Timeouts explícitos, sem reenvio automático
Abrir documentação API