Share feedback, ideas and get community help

Updated 2 months ago

Issue with Receiving Webhook Responses in TypeBot

πŸ”§ Problem Description
Hello! I'm having an issue where my TypeBot does not correctly receive responses from a webhook set up in Make. Below are the details:

🎯 Objective
I'm aiming for my TypeBot to receive responses from a Make webhook after sending data through a POST request, and I need these data to be accurately displayed in the TypeBot chat.

πŸ‘¨β€πŸ’» Code Used
Plain Text
const webhookUrl = 'https://hook.eu1.make.com/***********';
try {
  const response = await fetch(webhookUrl, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ nombre_usuario, consulta_cliente })
  });

  if (response.ok) {
    const data = await response.json();
    console.log('Complete response from webhook:', data);
    if (data.response) {
      console.log('Webhook message:', data.response.datos.mensaje);
      await Typebot.setVariable('respuesta_webhook', data.response.datos.mensaje);
      return data.response.datos.mensaje;
    } else {
      console.error('Response format unexpected or incomplete:', data);
      await Typebot.setVariable('respuesta_webhook', 'Sorry, there seems to be a problem with the response format.');
      return null;
    }
  } else {
    console.error('Problem with the request. Status:', response.status);
    await Typebot.setVariable('respuesta_webhook', 'Sorry, there was a problem with sending the query.');
    return null;
  }
} catch (error) {
  console.error('Error contacting the API:', error);
  await Typebot.setVariable('respuesta_webhook', 'There seems to be an error in processing the query.');
  throw error;
}
N
B
5 comments
πŸ” Specific Issue
The TypeBot does not receive or display the response from the webhook, even though the webhook seems to function correctly according to server logs and the expected server's response.

❓ Question
Could you help me understand what is failing in the integration between TypeBot and Make? Are there any additional settings or steps I should review to ensure that the webhook responses are handled correctly in TypeBot?

ℹ️ Additional Information
  • The current setup attempts to receive data from a webhook and use these data to set a variable in TypeBot.
  • I have verified that the webhook is sending the correct response, but it appears that TypeBot does not process or display these data as expected.
Thank you in advance for your assistance!
πŸ“œ Function Used in GPT Assistant
Plain Text
{
  "name": "buscar_productos",
  "description": "Searches for products in our database and provides the client with a response.",
  "strict": false,
  "parameters": {
    "type": "object",
    "properties": {
      "nombre_usuario": {
        "type": "string",
        "description": "The name of the client making the inquiry."
      },
      "consulta_cliente": {
        "type": "string",
        "description": "The client's query about a product, model, brand, category, or feature, displayed in a format of keywords separated by a plus sign."
      }
    },
    "required": ["nombre_usuario", "consulta_cliente"]
  }
}
You should use HTTP request block
Add a reply
Sign up and join the conversation on Discord