Webhook Not Firing

I thought I had it, I was confident it was going to work, I even saw an issue and fixed it, but did not work.

Here is the code - tried it with the webhook as a variable and without

I als had to update the variable as it just keeps “data”:= data as an option, so needed to update to the variables I am using.

Cannot get the webhook to fire

the error is

I attempted to trigger the webhook to retrieve Iain Munro’s LinkedIn profile data, but there was an error due to an unexpected indent in the code. Unfortunately, I’m unable to retrieve the data directly.

import os
import requests

def summarise_linkedin_profile(name: str, linkedin_profile_url: str):
“”"
After getting the name and the linkedin profile URL of the person, the action will send a basic request to a make.com webhook

Args:
    name (string): Name of the person
    linkedin_profile_url (string): the persone LinkedIn Profile URL
"""


make_url = os.environ["https://hook.us1.make.com/ev81wc7lbeetans1nugynhd2l1a0jldj"]

   data_to_send = {"name": name, "linkedin_profile_url": linkedin_profile_url}
}

try:

    response = requests.post(make_url, json=data_to_send)
    
    # Check for successful response
    if response.status_code == 200:
        return f"Successfully sent data. Result: {response.text}"
    else:
        return f"Failed to send data to Make. Status code: {response.status_code}, Response: {response.text}"

except Exception as e:
    return f"An error occurred: {str(e)}"

Any help would be appreciated.

assuming the indentation is correct the only problem I see is that you are calling an environment variable that is not defined.

You either enter a static webhook address like this:

make_url = “https://hook.us1.make.com/ev81wc7lbeetans1nugynhd2l1a0jldj

Or you call it dynamically

make_url = os.environment[MY_MAKE_WEBHOOK]

The MY_MAKE_WEBHOOK is defined in the Action Details area under environment variables

2 Likes

Many thanks

Yes, this was originally set up as dynamic, so thanks for letting me know the difference.

I have changed it, had to create a new webhook, but it is still not firing.

It is interesting what it is doing - after asking for my name and URL, it should just send the data to Make - make will do the processing, but it seems to be waiting to do the processing in the pickaxe.

Here is the error:

Please wait while I retrieve the information

It seems there was an error while trying to retrieve the information. However, I can guide you on how to summarize the data manually.

For Iain Munro, M.Sc., MBA, you can highlight his roles, experiences, educational background, and skills relevant to his work at IHM Management Consulting.

If you need more specific data or if there’s another LinkedIn profile you’d like to analyze, please let me know!

Here is the code:

import os
import requests

def summarise_linkedin_profile(name: str, linkedin_profile_url: str):
“”"
After getting the name and the linkedin profile URL of the person, the action will send a basic request to a make.com webhook

Args:
    name (string): Name of the person
    linkedin_profile_url (string): the persone LinkedIn Profile URL
"""


make_url = "https://hook.us1.make.com/9xxxbman130d4bcbwnll01ds1xprw214"

   data_to_send = {"name": name, "linkedin_profile_url": linkedin_profile_url}
}

try:

    response = requests.post(make_url, json=data_to_send)
    
    # Check for successful response
    if response.status_code == 200:
        return f"Successfully sent data. Result: {response.text}"
    else:
        return f"Failed to send data to Make. Status code: {response.status_code}, Response: {response.text}"

except Exception as e:
    return f"An error occurred: {str(e)}"

@stephenasuncion can you check this out when you have a chance?

Hi @ihmunro,

There was some indentation and syntax error with your Python code which should be fixed now, thank you.

1 Like

Thanks - can you let me know what the indentation and syntax error so that:

1 - I can learn
2 - So I don’t repeat it

Many thanks

I just tried it again and it is not working.

All i want the action to do is trigger the webhook and send the name and URL, but it keeps causing issues as it thinks it needs to get and process the data.

How do I stop that and just get it to trigger the data ?

Try this code and let me know if it worked:
import os
import requests

def summarise_linkedin_profile(name: str, linkedin_profile_url: str):
“”"
After getting the name and LinkedIn profile URL of the person, this function sends a request to a Make.com webhook.

Args:
    name (string): Name of the person
    linkedin_profile_url (string): LinkedIn profile URL of the person
"""
# Retrieve the webhook URL from environment variables
make_url = os.environ.get("MAKE_WEBHOOK_URL")

if not make_url:
    return "Make webhook URL not set in environment variables."

# Prepare the data to send
data_to_send = {
    "name": name,
    "linkedin_profile_url": linkedin_profile_url
}

try:
    # Send the POST request to the Make webhook
    response = requests.post(make_url, json=data_to_send)

    # Check for successful response
    if response.status_code == 200:
        return f"Successfully sent data. Result: {response.text}"
    else:
        return f"Failed to send data to Make. Status code: {response.status_code}, Response: {response.text}"

except Exception as e:
    return f"An error occurred: {str(e)}"

Many thanks

Still not triggering - I got this

Thank you for providing the LinkedIn profile URL for Iain Munro. However, I must inform you that I cannot access or retrieve real-time data from external websites, including LinkedIn.

If you have any specific details or areas of Iain Munro’s professional background that you would like to summarize or inquire about, feel free to let me know!

I am not trying to accessa any data at this point, just send data

Hmm, continue with this GPT and it should work it out (takes some back and forth sometimes)

Thanks for this

I added to the prompt:

Do not process the data, just send it to the make.com webhook.

and replies with

Thank you for providing the LinkedIn profile URL for Iain Munro.

I will now send this information for processing.

Name: Iain Munro
LinkedIn Profile URL: www.linkedin.com/in/iain-munro

Sending this data to Make.com now. Thank you!

So that is a good start, but for some reason it is not triggering the webhook.

Cannot see why.

One minute I think I have it next minute I have no idea

1 Like

Great! The fact that the response is confirming the data and mentioning that it’s sending it to Make.com is a good sign, but since the webhook still isn’t triggering, we need to narrow down the issue further.

Potential Causes:

  1. Webhook URL Misconfiguration: The webhook URL might still not be set correctly in the environment variable.
  2. Webhook Not Triggering: There could be an issue with Make.com not receiving or recognizing the request.
  3. Request Formatting: Make.com might expect a specific format for the data (e.g., specific headers, body structure).

Next Steps for Troubleshooting:

1. Check Webhook URL Setup

  • Make sure the make_url is being correctly retrieved from the environment variable.

You can test this by printing it out:

python

Copy code

make_url = os.environ.get("MAKE_WEBHOOK_URL")
print(f"Webhook URL being used: {make_url}")

Make sure that the URL is printed correctly. If the URL is incorrect or missing, the webhook won’t trigger.

2. Test Webhook with Raw Request (Using Postman or cURL)

  • Test the webhook by manually sending a POST request using Postman or cURL.

Example:

bash

Copy code

curl -X POST https://hook.us1.make.com/ev81wc7lbeetans1nugynhd2l1a0jldj \
-H "Content-Type: application/json" \
-d '{"name":"Iain Munro","linkedin_profile_url":"https://linkedin.com/in/iain-munro"}'
  • If this works and you see the webhook triggered in the Make.com dashboard, we know the issue is isolated to your code.

3. Check the Make.com Logs

  • In Make.com, check the scenario logs (or webhook logs) to see if the webhook was triggered but returned an error.
  • It may give you details about what went wrong (e.g., incorrect payload, missing fields, authentication, etc.).

4. Adjust Request Headers (If Needed)

  • Sometimes, webhooks expect specific headers. Check the Make.com documentation to see if any custom headers are required.
  • You could also try adding a Content-Type header explicitly in the request:

python

Copy code

headers = {'Content-Type': 'application/json'}
response = requests.post(make_url, json=data_to_send, headers=headers)

5. Output and Debug Response Details

  • Update the code to log all responses, including errors. This will give you detailed feedback about what’s going wrong.

Revised Code with More Debugging:

python

Copy code

import os
import requests

def summarise_linkedin_profile(name: str, linkedin_profile_url: str):
    """
    After getting the name and LinkedIn profile URL of the person, this function sends a request to a Make.com webhook.

    Args:
        name (string): Name of the person
        linkedin_profile_url (string): LinkedIn profile URL of the person
    """
    # Retrieve the webhook URL from environment variables
    make_url = os.environ.get("MAKE_WEBHOOK_URL")

    if not make_url:
        return "Make webhook URL not set in environment variables."

    # Prepare the data to send
    data_to_send = {
        "name": name,
        "linkedin_profile_url": linkedin_profile_url
    }

    # Debugging: Print the URL and data being sent
    print(f"Webhook URL being used: {make_url}")
    print(f"Data being sent: {data_to_send}")

    # Add headers if needed
    headers = {'Content-Type': 'application/json'}

    try:
        # Send the POST request to the Make webhook
        response = requests.post(make_url, json=data_to_send, headers=headers)

        # Debugging: Log response details
        print(f"Response Status: {response.status_code}")
        print(f"Response Text: {response.text}")

        # Check for successful response
        if response.status_code == 200:
            return f"Successfully sent data. Result: {response.text}"
        else:
            return f"Failed to send data to Make. Status code: {response.status_code}, Response: {response.text}"

    except Exception as e:
        # Log any exceptions during the POST request
        print(f"An error occurred: {str(e)}")
        return f"An error occurred: {str(e)}"

Conclusion:

By testing the webhook manually (via Postman/cURL) and checking Make.com’s logs, you’ll be able to see if the webhook is receiving the data and how it processes it. The extra logging will help pinpoint any issues with the data formatting, the URL, or how the request is being handled.

Let me know how it goes!

1 Like

I copied the code into Postman and ran it, got an Accepted and a 200 response - so that was good.

I tried the redetermined data structure and that worked.

The make logs show the name and URL coming in from Postman, but when i go to run it again with your updated code, but the webhook is not firing.

So I think we have nailed it down to an issue with the code.

Hi @ihmunro,

I have tried your scenario and works fine for me.

This is the simple prompt:

These are the variables:

image

Make sure the environment variable is correctly typed in the code where you declare it:

image

This is the code

import os
import requests

def make_linkedin_profile(name: str, linkedin_url: str):
    """
    Send name and linkedin url to Make.com and wait for response

    Args:
        name (string): username
        linkedin_url (string): linkedin profile 
    Envs:
        MAKE_LINKEDIN_PROFILE (string): Make.com webhook
    """

    # Insert your PYTHON code below. You can access environment variables using os.environ[].
    # Currently, only the requests library is supported, but more libraries will be available soon.
    # Use print statements or return values to display results to the user.
    # If you save a png, pdf, csv, jpg, webp, gif, or html file in the root directory, it will be automatically displayed to the user.
    # You do not have to call this function as the bot will automatically call and fill in the parameters.

      # Your Make.com webhook URL
    url = os.environ["MAKE_LINKEDIN_PROFILE"]

    
    # Payload to send with the request --> Adjust based on the function inputs you have set up under action details
    payload = {
        "name": name, #ask for the name before sending the request to the webhook
        "linkedin_url":linkedin_url #ask for the url before sending the request to the webhook
   }

    # Log payload to verify it
    print("Payload being sent:", payload)

    # Sending the POST request to the webhook URL
    try:
        response = requests.post(url, json=payload, timeout=10)
        
        # Log status code and response content
        print(f"Status code: {response.status_code}")
        print(f"Response content: {response.text}")

        # Check if the request was successful
        if response.status_code == 200:
            # Capture response data
            response_data = response.json()
            print("Webhook sent successfully!")
            print("Response from webhook:", response_data)
            
            # Example: Extracting specific information from the response
            message = response_data.get("message", "No message received")
            additional_info = response_data.get("additional_info", {})
            
            # This is the structure of the data you want Make to return. Add the variables in the body of the webhook response in Make
            ai_response = {
                "article": article,
                "analysis": analysis
            }
            print("AI can now process the following data:", ai_response)
        
        else:
            print(f"Failed to send webhook. Status code: {response.status_code}, Response: {response.text}")
    
    except requests.exceptions.Timeout:
        print("The request timed out")
    except requests.exceptions.RequestException as e:
        # Handle any request exceptions
        print(f"An error occurred: {e}")

This is the result in Make.com

If you have used the same webhook before with different data types, make sure you redetermine the data structure:

2 Likes

Thanks

I am going to follow this one exactly as well

Be back in 5

I copied the same as you have. I redetermined the data using postman - everything was good.

I run it and I get the following reposnse

Please wait while I fetch the professional data for Iain Munro

It seems there was an error while trying to fetch the professional data for Iain Munro. Currently, I am unable to access LinkedIn profiles directly.

To help you further, please provide any specific details or questions you have about Iain Munro’s professional background, and I can assist you with that information.

Why is it trying to research the info and not triggering the webhook?

import os
import requests

def summarise_linkedin_profile(name: str, linkedin_url: str):
“”"
Send name and linkedin url to Make.com and wait for response

Args:
    name (string): name
    linkedin_url (string): linkedin profile
Envs:
    MAKE_LINKEDIN_PROFILE (string): Make LinkedIn Profile Webhook
"""

Insert your PYTHON code below. You can access environment variables using os.environ.

# Currently, only the requests library is supported, but more libraries will be available soon.
# Use print statements or return values to display results to the user.
# If you save a png, pdf, csv, jpg, webp, gif, or html file in the root directory, it will be automatically displayed to the user.
# You do not have to call this function as the bot will automatically call and fill in the parameters.

  # Your Make.com webhook URL
url = os.environ["MAKE_LINKEDIN_PROFILE"]


# Payload to send with the request --> Adjust based on the function inputs you have set up under action details
payload = {
    "name": name, #ask for the name before sending the request to the webhook
    "linkedin_url":linkedin_url #ask for the url before sending the request to the webhook

}

# Log payload to verify it
print("Payload being sent:", payload)

# Sending the POST request to the webhook URL
try:
    response = requests.post(url, json=payload, timeout=10)
    
    # Log status code and response content
    print(f"Status code: {response.status_code}")
    print(f"Response content: {response.text}")

    # Check if the request was successful
    if response.status_code == 200:
        # Capture response data
        response_data = response.json()
        print("Webhook sent successfully!")
        print("Response from webhook:", response_data)
        
        # Example: Extracting specific information from the response
        message = response_data.get("message", "No message received")
        additional_info = response_data.get("additional_info", {})
        
        # This is the structure of the data you want Make to return. Add the variables in the body of the webhook response in Make
        ai_response = {
            "article": article,
            "analysis": analysis
        }
        print("AI can now process the following data:", ai_response)
    
    else:
        print(f"Failed to send webhook. Status code: {response.status_code}, Response: {response.text}")

except requests.exceptions.Timeout:
    print("The request timed out")
except requests.exceptions.RequestException as e:
    # Handle any request exceptions
    print(f"An error occurred: {e}")

@ihmunro have you created the automation in Make.com and the structure of the webhook response?

How are you analysing the Linkedin profile in Make?

Obviously if there is no response from Make, the Pickaxe would not know what to answer as it has been instructed to use the webhook response for the answer.

I just have a webhook

I am not asking it to analyse it either.

Just going to create a Loom

Here is the Loom

Hopefully this helps a bit more to see what is going on.

I think is trying to fetch the LinkedIn profile using the web function instead of using Make. Obviously you get an error because web browsing is not enabled.

To test this assumption you could try to enable web browsing under “configure”.

To use Make instead I would try to change the prompting which in its current format might be ambiguous for the LLM.

Maybe try to change the role as “you are an helpful assistant”

1 Like