Preferenze di tracking: Lettura

List Changes

Ogni modifica delle preferenze del tuo account, dalla più vecchia, con un cursore. Mantieni sincronizzato il tuo CRM senza perderne una.

POSThttps://g.sendcorex.com/v1/privacycommand: list_changes

Richiede lo scope privacy:read sulla tua API key.

Conserva next_cursor e invialo alla chiamata successiva. Torna sempre, anche quando non è cambiato nulla.

Le modifiche compaiono circa 5 secondi dopo che sono avvenute, e il feed conserva gli ultimi 90 giorni.

Argomenti

  • cursorstringfacoltativo

    Il next_cursor della chiamata precedente. Senza, inizi dall'inizio dei 90 giorni.

    es. "ZjowMDAwMDAwMDgzOjE3NjEyOTA0MTIwMzE6amFuZS5kb2VAZXhhbXBsZS5jb20"

  • limitnumberfacoltativo

    Modifiche per chiamata, da 1 a 1000. Predefinito 100.

    es. 100

Avvio rapido

import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1/privacy',
  {
    commands: [
      {
        command: "list_changes",
        args: {
          cursor: "ZjowMDAwMDAwMDgzOjE3NjEyOTA0MTIwMzE6amFuZS5kb2VAZXhhbXBsZS5jb20",
          limit: 100
        }
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);

const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);

Risposta

{
  "type": "SUCCESS",
  "results": [
    {
      "command": "list_changes",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 6,
      "data": {
        "changes": [
          {
            "email": "jane.doe@example.com",
            "track_opens": false,
            "track_clicks": true,
            "source": "page",
            "updated_at": "2026-10-24T07:20:12.031Z"
          },
          {
            "email": "marc.dupont@example.fr",
            "track_opens": false,
            "track_clicks": false,
            "source": "api",
            "updated_at": "2026-10-24T07:41:55.508Z"
          }
        ],
        "next_cursor": "ZjowMDAwMDAwMDgzOjE3NjEyOTA0MTIwMzE6amFuZS5kb2VAZXhhbXBsZS5jb20",
        "has_more": false
      }
    }
  ]
}

Campi della risposta

  • changes

    Le modifiche di questa chiamata, dalla più vecchia. Ognuna è lo stato completo del destinatario dopo la modifica.

  • next_cursor

    Invialo come cursor alla chiamata successiva.

  • has_more

    true quando altre modifiche sono già in attesa: richiama subito.

  • changes[].email

    L'indirizzo del destinatario, in minuscolo.

  • changes[].track_opens

    true il destinatario consente il tracking delle aperture, false lo ha rifiutato, null non ha mai scelto.

  • changes[].track_clicks

    true il destinatario consente il tracking dei clic, false lo ha rifiutato, null non ha mai scelto.

  • changes[].source

    Chi ha fatto la modifica: page (il destinatario, nella pagina delle preferenze di tracking), api (tu, con Set Preferences) o dashboard.

  • changes[].updated_at

    Quando è stata fatta la modifica. ISO 8601, UTC.

Sincronizza con il tuo CRM

Salva il cursore in un posto che sopravvive a un riavvio. A ogni ciclo leggi finché has_more è false e scrivi ogni modifica nel contatto del tuo CRM (Salesforce, HubSpot…).

Node.js

let cursor = await loadCursor(); // null the first time

async function sync() {
  let more = true;
  while (more) {
    const [r] = await call({ command: 'list_changes', args: cursor ? { cursor, limit: 500 } : { limit: 500 } });
    for (const c of r.data.changes) {
      if (c.source === 'api') continue; // you made this change yourself
      await crm.updateContact(c.email, { trackOpens: c.track_opens, trackClicks: c.track_clicks, consentAt: c.updated_at });
    }
    cursor = r.data.next_cursor;
    await saveCursor(cursor);
    more = r.data.has_more;
  }
}

setInterval(sync, 60_000);

Preferisci il push? Il webhook tracking_preferences_updated invia ogni modifica fatta sulla pagina nel momento in cui avviene. Usa questo comando come rete di sicurezza.

Errori

Gli errori a livello HTTP restituiscono type, code e message. Gli errori marcati CMD tornano dentro il risultato del comando, con HTTP 200.

  • 401INVALID_API_KEY

    La API key non esiste, è stata revocata o disattivata nella dashboard.

  • 429RATE_LIMITED

    Più di 15 richieste/s o 15 in corso per la stessa IP + API key. Attendi i secondi indicati in Retry-After.

  • CMDMISSING_SCOPE

    La API key non ha lo scope di questo comando (`privacy:read` per leggere, `privacy:write` per modificare).

  • CMDINVALID_ARGS

    Un argomento non è valido: `email` mancante o malformata, più di 100 `emails`, `track_opens` diverso da `true`/`false`, limit fuori intervallo…

  • CMDINVALID_CURSOR

    Il cursore non è valido o proviene da un altro account. Ricomincia senza cursore.

  • CMDINTERNAL

    Errore del server. Il dettaglio viene scritto solo nel log del server.