API REST para gestionar leads de Pawify Growth. Autenticacion via Supabase Auth.
Todas las peticiones requieren un token de acceso. Usa tu email/password de Pawify para obtener uno.
await API.login('tu@email.com', 'password');
// Guarda el token automaticamente para las siguientes llamadas
Obtiene todos los leads. Puedes filtrar por pais o status.
const leads = await API.getLeads();
const spain = await API.getLeads({ country: 'Espana' });
const contacted = await API.getLeads({ status: 'contacted' });
| Campo | Tipo | Requerido |
|---|---|---|
shelter_name | string | Si |
email | string | Si |
country | string | No |
city | string | No |
phone | string | No |
website | string | No |
status | string | No (default: "new") |
animal_types | string | No (default: "all") |
notes | string | No |
await API.addLead({
shelter_name: 'Refugio Sol',
email: 'info@refugiosol.es',
country: 'Espana',
city: 'Valencia',
status: 'new'
});
Inserta multiples leads de una vez. Acepta un array de objetos o un CSV parseado.
// Array de objetos
await API.bulkAdd([
{ shelter_name: 'Refugio A', email: 'a@test.com', country: 'Espana' },
{ shelter_name: 'Refugio B', email: 'b@test.com', country: 'Francia' },
{ shelter_name: 'Refugio C', email: 'c@test.com', country: 'Portugal' },
]);
// Desde CSV const csv = `shelter_name,email,country,city Refugio Sol,sol@test.com,Espana,Madrid Abri Lumiere,abri@test.com,Francia,Paris`; const leads = API.parseCSV(csv); await API.bulkAdd(leads);
await API.updateLead('uuid-del-lead', { status: 'contacted', notes: 'Llamada realizada' });
Cambia el status de multiples leads a la vez.
await API.bulkUpdateStatus(['uuid-1', 'uuid-2', 'uuid-3'], 'contacted');
await API.deleteLead('uuid-del-lead');