Share feedback, ideas and get community help

D
F
M
a
g

Send a Webhooks to Make from the function code (GTP Wizard)

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;
}
}
Attachment
OpenAI-Conditions-Editor-Typebot_1.jpg
V
N
2 comments
Eliminate the function definition (lines 1 and 27).
Also, return the data variable.
Hi @Vilela™ , Great!! Thanks.
Add a reply
Sign up and join the conversation on Discord
Join