Files
android-sms-gateway/SKILL.md
T
2026-08-25 02:18:50 +03:30

3.7 KiB

name, description
name description
android-sms-gateway Operate an Android SMS Gateway over its versioned HTTP API to check health or status, send SMS, and read incoming or outgoing message history. Use when a user wants to interact with a configured gateway; do not use for generic Android development or unrelated SMS providers.

Android SMS Gateway

Use the directly reachable Android device as an HTTP SMS gateway. The gateway has no cloud relay, polling, FCM, or WebSocket connection.

Treat openapi.yaml as the authoritative contract. The installed gateway provides interactive documentation at GET /docs and serves the same packaged contract from GET /docs/openapi.yaml. Read either contract copy when exact schemas, parameters, or response codes matter; do not invent endpoints or fields.

Connection

Obtain these values from the user or the active environment:

GATEWAY_BASE_URL=http://192.168.1.50:8080
GATEWAY_API_KEY=<gateway API key>

Never print the API key, place it in a URL, or persist it in logs or generated artifacts. Send it with Authorization: Bearer <key>; X-API-Key is supported only when Bearer authentication is impractical.

Plain HTTP is unencrypted. Use the gateway only over a trusted LAN, VPN, or TLS-terminating proxy. Do not weaken authentication or allowlisting to work around connectivity problems unless the user explicitly requests the configuration change and understands the exposure.

Workflow

  1. Call GET /api/v1/health before other operations to verify reachability, device identity, API version, and uptime.
  2. Call GET /api/v1/status when server state or counters are relevant.
  3. Use POST /api/v1/sms/send only when the user has explicitly authorized the exact recipient and message. Sending an SMS is an external side effect.
  4. Preserve the returned message ID. HTTP 202 means Android accepted the submission for processing, not that the carrier delivered it.
  5. Use GET /api/v1/sms/messages/{id} to inspect the later local status.
  6. Use the paginated messages endpoint to read history. Prefer direction=incoming when the user asks for received SMS.

Do not automatically retry a timed-out send. The gateway may have accepted it even if the response was lost, and this MVP has no idempotency key. Ask for confirmation or use application-level duplicate protection before retrying.

Requests

Health:

curl --fail-with-body \
  -H "Authorization: Bearer $GATEWAY_API_KEY" \
  "$GATEWAY_BASE_URL/api/v1/health"

Send one SMS:

curl --fail-with-body \
  -X POST \
  -H "Authorization: Bearer $GATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"to":"+989121234567","message":"Hello"}' \
  "$GATEWAY_BASE_URL/api/v1/sms/send"

Read incoming messages:

curl --fail-with-body \
  -H "Authorization: Bearer $GATEWAY_API_KEY" \
  "$GATEWAY_BASE_URL/api/v1/sms/messages?direction=incoming&page=1&page_size=50"

Read one message:

curl --fail-with-body \
  -H "Authorization: Bearer $GATEWAY_API_KEY" \
  "$GATEWAY_BASE_URL/api/v1/sms/messages/MESSAGE_ID"

Interpret Results

  • pending: waiting for Android's send result.
  • sent: Android's SMS service accepted the operation; this is not a delivery report.
  • failed: Android reported a failure; inspect error_code.
  • Message timestamps are Unix epoch milliseconds. Health and status uptime is seconds.
  • Error responses contain success: false and a stable error.code; branch on the code rather than the human-readable message.

For health and read operations, retry transient 5xx failures with bounded exponential backoff. Do not retry unchanged credentials after 401, an unchanged client address after 403, or SMS sends without duplicate protection.