Share feedback, ideas and get community help

Updated last year

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

At a glance

The community member has created a function in the GPT wizard that asks the user for their name, email, and query, and then sends the data to a Make webhook. However, the community member is having an issue where the data is not being sent to the Make webhook, and they are not receiving a response. The community member has provided the code for the function and is asking for help in identifying the error.

In the comments, another community member suggests eliminating the function definition (lines 1 and 27) and returning the data variable. The second community member responds positively to this suggestion.

There is no explicitly marked answer in the post or comments.

Useful resources
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