I have created a function in the GPT wizard. I want that when a customer requests to contact, it asks the user for the name, email and query. This works fine, but I have the problem when the call to Make is executed.
It does not send the data to Make and therefore, I do not receive a response.
This is my code, any idea where the error is?
async function contactarWebhook(nombre, email, consulta) {
const webhookUrl = '
https://hook.eu1.make.com/zef3***************************';
try {
const response = await fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ nombre, email, consulta })
});
const data = await response.json();
if (response.ok && data.success) {
console.log('La consulta ha sido enviada con éxito.');
return data;
} else {
console.error('Hubo un problema al enviar la consulta:', data);
return null;
}
} catch (error) {
console.error('Error al contactar con la API:', error);
throw error;
}
}