Zapier


First Section

// Funzione per inviare la richiesta POST
const sendPOSTRequest = async () => {
    const url = 'https://api.connect.ilpas.it/leads/new';
    const connectKey = '<token>';
    const data = {
        nome: "Mario",
        cognome: "Bianchi",
        tel: "1234567890",
        provenienza: "Zapier",
        email: "mario.rossi@example.com",
        datadinascita: "1990-01-01"
    };

    const response = await fetch(url, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'connectKey': connectKey
        },
        body: JSON.stringify(data)
    });

    return await response.json();
};

// Eseguire la funzione e gestire la risposta
output = await sendPOSTRequest()
    .then(response => {
        return response;
    })
    .catch(error => {
        return error;
    });