Localizado por IA

Agregar suscriptor

const response = await fetch('https://api.emailit.com/v2/audiences/aud_1234567890/subscribers', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    email: 'juan.perez@ejemplo.com',
    first_name: 'Juan',
    last_name: 'Pérez',
    custom_fields: {
      company: 'Empresa ABC',
      role: 'Desarrollador'
    }
  })
});

const result = await response.json();

Respuestas

{
  "object": "subscriber",
  "id": 1234567890,
  "audience_id": 1234567890,
  "contact_id": 1234567890,
  "email": "juan.perez@ejemplo.com",
  "first_name": "Juan",
  "last_name": "Pérez",
  "custom_fields": {
    "company": "Empresa ABC",
    "role": "Desarrollador"
  },
  "subscribed": true,
  "subscribed_at": "2021-01-01T00:00:00Z",
  "unsubscribed_at": null,
  "created_at": "2021-01-01T00:00:00Z",
  "updated_at": "2021-01-01T00:00:00Z"
}