6,3 KiB
6,3 KiB
name: sms-center description: Send SMS through the Interweb Angola SMS Center API: single and batch messages, scheduled sending, one-time verification codes (OTP), sender IDs, templates, contacts and groups, delivery webhook, opt-outs, balance and statistics. Use when the user wants their application to send SMS, add phone verification, request a sender name or check the SMS balance.
Interweb Angola SMS Center
Use this skill to send SMS to mobile numbers from an application or a script.
Setup
- API address:
https://api.interweb.ao/v1. It is fixed for Interweb Angola: never ask the user for another address. - API key: always read it from the
INTERWEB_API_KEYenvironment variable. Check it without printing it:test -n "$INTERWEB_API_KEY" && echo set || echo missing - If it is missing, ask the user to create a key in the API Center (https://www.meu.interweb.ao/api-center.php) with
sms:read(andsms:writeto send and change), then to runexport INTERWEB_API_KEY="sandbox_..."and restart Claude Code (or the editor). sandbox_keys read the real account but only simulate writes and never charge.prod_keys change the account and can charge.GET /v1/tokengives the mode indata.modeand the permissions indata.permissions. Suggest asandbox_key for a first try.- Never print, log or commit the key, and never put it in code that runs in a browser or a mobile app. In code, read it from the environment.
Every request looks like this:
curl -sS "https://api.interweb.ao/v1/PATH" -H "Authorization: Bearer $INTERWEB_API_KEY" -H "Accept: application/json"
Rules
- Before anything that charges, deletes data or cannot be undone, tell the user exactly what will happen (with the price, when the API gives one) and wait for a clear yes.
- Send an
Idempotency-Keyheader on purchases, sends and other POST requests that accept it, and reuse the same value if you retry the same request:IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid). - Lists come in pages:
?page=1&per_page=100, andmeta.total_pagessays how many there are. - Long operations answer
202with anaction_id. Follow them withGET /v1/actions/{action_id}every 10 to 20 seconds untilstatusisdoneorfailed. - Answer the user in the language they write in, and show amounts with the currency the API returns.
Before sending
- SMS must be active on the account. Otherwise the API answers
403withsms_not_active: the user turns it on in the SMS Center, in Meu Interweb. - With a
sandbox_key nothing is sent and no credits are used. With aprod_key every message uses SMS credits.
Send one SMS
curl -sS -X POST "https://api.interweb.ao/v1/sms/messages" -H "Authorization: Bearer $INTERWEB_API_KEY" \
-H "Content-Type: application/json" -H "Idempotency-Key: $IDEM" \
-d '{"number": "+244923123456", "text": "Your order is ready."}'
numberworks with or without the country code and with spaces. An invalid number answers422withdetails.reasoninvalid_number.senderis optional: without it the free sender is used (the first inGET /v1/sms/senders, withfree: true). Only approved senders work.- Without
send_atthe answer has the real status:sent,failedorqueued. send_at(ISO 8601 with time zone, for example2026-12-01T09:00:00+01:00, at most 365 days ahead) schedules; cancel withPOST /v1/sms/messages/{id}/cancel.- Batch:
POST /v1/sms/messages/batchwith{"text": "...", "messages": [{"number": "..."}, {"number": "...", "text": "own text"}]}. - Before a large send with a
prod_key, checkGET /v1/sms/balance, say how many messages will go and ask.
Verification codes (OTP)
curl -sS -X POST "https://api.interweb.ao/v1/sms/otp" -H "Authorization: Bearer $INTERWEB_API_KEY" \
-H "Content-Type: application/json" -H "Idempotency-Key: $IDEM" \
-d '{"number": "+244923123456", "length": 6, "expires_in": 5}'
curl -sS -X POST "https://api.interweb.ao/v1/sms/otp/OTP_ID/verify" -H "Authorization: Bearer $INTERWEB_API_KEY" \
-H "Content-Type: application/json" -d '{"code": "482913"}'
- Keep the
otp_...id on the server, never in the browser. Resend withPOST /v1/sms/otp/{id}/resend, cancel withPOST /v1/sms/otp/{id}/cancel. textis optional and must contain{code}once (and may contain{minutes}).- Default rules:
GETorPUT /v1/sms/otp-settings.
Senders, templates and contacts
- New sender name:
POST /v1/sms/senderswithsender,entity,country(the country code, such asAO),tax_id,purposeandsample. Approval takes time; follow it withGET /v1/sms/senders/{sender}. Ask the user for the real company data, never invent it. - Templates:
/v1/sms/templates. Contacts and groups:/v1/sms/contactsand/v1/sms/groups. - Opt-outs:
GETorPOST /v1/sms/opt-outs. Never send marketing to numbers on that list. - Delivery webhook:
PUT /v1/sms/webhook, test withPOST /v1/sms/webhook/test.
Balance and statistics
GET /v1/sms/balance, GET /v1/sms/stats and GET /v1/sms/messages. More credits: GET /v1/sms/credits/prices, then POST /v1/sms/credits/purchase (charges credit, ask first).
Errors
Errors look like {"error": {"code", "message", "correlation_id", "details"}}. Act on code, never on the text of message.
| HTTP | code | What to do |
|---|---|---|
| 401 | unauthorized |
The key is missing, wrong or revoked. Ask the user to check INTERWEB_API_KEY. |
| 402 | insufficient_credit |
Not enough account credit, and nothing was charged. Give the user details.add_funds_url. |
| 403 | insufficient_scope |
The key lacks a permission. Name it and ask for a key that has it. |
| 403 | spending_limit_exceeded |
The purchase goes over the key spending limit. Nothing was charged. |
| 404 | not_found |
Wrong id, or it is not in this account. |
| 409 | conflict and others |
Read details.reason and explain it in plain words. |
| 422 | validation_failed |
Fix the field named in details and try again. |
| 429 | rate_limited |
Wait for the Retry-After seconds, then try once more. |
| 5xx | internal_error, upstream_error |
Try again later. If the user contacts support, give them the correlation_id. |
More
- SMS: https://docs.interweb.ao/sms/
- Rules, limits and Sandbox: https://docs.interweb.ao/api-rules/
- Full reference: https://api.interweb.ao/v1/openapi.json