I have experimented with several different prompts and solutions, including requesting ChatGPT to modify the code to incorporate a time delay. This adjustment is intended to give make.com enough time to process the request to run ChatGPT and subsequently return the result. Unfortunately, despite these efforts, I consistently face a timeout error when making requests on Pickaxe, which prevents me from successfully executing my intended operations.
Timeout Error Message:
"Generating the Buyer Persona for Victor S. Please wait…
It looks like there was a timeout while generating the Buyer Persona for Victor S. This sometimes happens if the system is busy or processing a detailed persona."
Action Code:
import os
import requests
def send_a_basic_request_to_webhook(first_name: str, last_name: str, website_url: str, email_address: str:
“”"
Sends a basic request to a webhook and waits for the response
Args:
first_name (string): Answer to the question "First Name"
last_name (string): Answer to the question "Last Name"
website_url (string): Answer to the question "Website URL"
email_address (string): Answer to the question "Email Address"
Envs:
MAKE_COM_WEBHOOK (string): Webhook link from Make.com
"""
# Insert your 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 image 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 = "XXXX"
# Payload to send with the request --> Adjust based on the function inputs you have set up under action details
payload = {
"First Name": first_name, #Answer to the question "First Name"
"Last Name": last_name, #Answer to the question "Last Name"
"Website URL": website_url, #Answer to the question "Website URL"
"Email Address": email_address, #Answer to the question "Email Address"
}
print("Payload being sent:", payload)
try:
response = requests.post(url, json=payload, timeout=10)
print(f"Status code: {response.status_code}")
print(f"Response content: {response.text}")
if response.status_code == 200:
response_data = response.json()
print("Webhook sent successfully!")
print("Response from webhook:", response_data)
# Capture and return the Buyer Persona from response
worlds_best_buyer_persona = response_data.get("buyer_persona", "No persona data received")
print("Buyer Persona:", buyer_persona)
return buyer_persona
else:
print(f"Failed to send webhook. Status code: {response.status_code}, Response: {response.text}")
return None
except requests.exceptions.Timeout:
print("The request timed out")
return None
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
return None