RCSZilla Versione 1.0

Poll (Unificato)

Guida all'integrazione dell'app mobile

Poll (Unificato)

POST /?endpoint=poll

L'endpoint preferito per il ciclo di servizio Android. Un singolo POST sostituisce le chiamate separate a heartbeat, pending_messages, get_config e il recupero dei comandi.

*
Recommended: Use poll as your primary background-service loop. It replaces pending_messages, heartbeat, get_config, and command fetching in a single request.

Corpo della richiesta (all fields optional)

CampoTipoDescrizione
service_activebooleantrue se il servizio in background รจ in esecuzione.
sms_countintegerTotale SMS inviati dall'ultimo reset.
fail_countintegerTotale messaggi falliti dall'ultimo reset.
whatsapp_enabledbooleantrue se WhatsApp รจ connesso sul dispositivo.
is_default_smsbooleantrue se questa app รจ il gestore SMS predefinito.
fcm_tokenstringToken FCM aggiornato (invia solo quando cambia).
ack_idsinteger[]Array di ID comandi da confermare ed eliminare prima di riceverne di nuovi.
sms_limitintegerMassimo elementi SMS in questa risposta (1-10, predefinito 1).
wa_limitintegerMassimo elementi WhatsApp in questa risposta (1-10, predefinito 10).

Esempio di richiesta

cURL
curl -X POST "https://api.rcszilla.com/?endpoint=poll" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR-DEVICE-TOKEN" \
  -d '{
    "service_active": true,
    "sms_count": 42,
    "fail_count": 1,
    "whatsapp_enabled": false,
    "is_default_sms": true,
    "ack_ids": [88, 89],
    "sms_limit": 5,
    "wa_limit": 10
  }'

Risposta

JSON200 OK
{
  "success": true,
  "config": {
    "retry_limit": "3",
    "poll_interval_seconds": "5"
  },
  "commands": [
    {"id": 90, "command": "restart_service", "payload": null}
  ],
  "sms": [
    {
      "id": 103,
      "channel": "sms",
      "phone": "+40712345678",
      "message": "Hello!",
      "sim_slot": 0,
      "device_id": 7,
      "campaign_id": null,
      "priority": 1,
      "scheduled_at": null,
      "created_at": "2026-04-29 10:05:00"
    }
  ],
  "whatsapp": [],
  "ai_config": null
}

Response Fields

CampoTipoDescrizione
configobjectKey/value device configuration set from the web panel.
commandsarrayPending commands for this device. ACK them via ack_ids on the next poll.
smsarrayClaimed SMS messages ready to send (same schema as pending_messages).
whatsapparrayClaimed WhatsApp messages ready to send.
ai_configobject|nullWhatsApp Gemini AI configuration (system prompt, keys, model settings). null if not configured.

Command Payload

commandDescrizione
restart_serviceApp should restart its background SMS service.
set_default_smsPrompt user to set app as default SMS handler.
update_configRe-fetch config (payload contains changed keys).
*
Ad ogni poll, il server reimposta automaticamente i messaggi bloccati in processing da piรน di 5 minuti a pending.

Typical Service Loop (Android)

Kotlin (pseudocode)
while (serviceRunning) {
    val resp = api.poll(
        service_active = true,
        sms_count      = smsSentTotal,
        ack_ids        = pendingAckIds
    )
    pendingAckIds.clear()

    for (cmd in resp.commands)  handleCommand(cmd)
    for (sms in resp.sms)       sendSms(sms)
    for (wa  in resp.whatsapp)  sendWhatsApp(wa)

    Thread.sleep(pollIntervalMs)
}