ab2308 is really good at getting it to work, but not so good at showing how he does it. It would take zero extra time to create a loom that we would all benefit from.
@ihmunro I posted another video in the how-to section. Sorry I have a business to run so I don’t always have time to shoot videos. In any case I hope this one helps.
import os
import requests
def test_video_transcript(summary: str, email: str, headline: str):
"""
Send summary of the video to the user
Args:
summary (string): summary of the video
email (string): user's email
headline (string): transcript headline
Envs:
MAKE_WEBHOOK (string): make 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_WEBHOOK"]
# Payload to send with the request
payload = {
"summary": summary,
"email": email,
"headline": headline
}
# 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 (status code 200-299 are success codes)
if response.status_code in range(200, 300):
# Capture response data
response_data = response.json()
print("Webhook sent successfully!")
print("Response from webhook:", response_data)
# Check if the email was sent correctly
if response_data.get("message") == "email has been sent correctly":
print("Email has been confirmed as sent correctly.")
else:
print("Email status unclear: ", response_data.get("message", "No message received"))
else:
# Log failed request details
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}")
I came across a similar issue but the data was in fact sent to Make even if it was not acknowledging it. The reason was the prompt. Did you change the prompt and did you check if the Make webhook triggered?
My understanding is that you want to create an email template and send it to Make rather than sending an email with the bot.The prompt is slightly ambiguous so the bot thinks it needs to send an email other than triggering the action.
Separate the prompt with sections like in my video and avoid phrases like “create an email” or “send an email” as these might be interpreted as actions the bot needs to trigger.
Note this is how LLM prompting works and not something related to the bot / Pickaxe
You are an adaptive and proficient assistant, dedicated to taking the information provided and turning it into an Email template for the user.
Your main job is to take the content provided in order to make an Email template.
Please provide the Subject Headline, the Preview Text Headline, and the main content for the email template.
When developing the email template, provoke curiosity for the reader, enhance a storyline when possible, and avoid strong claims.
Don’t include any clickable links in the emails
GOAL
Provide the user with an incredible email template that can be used to turn leads into paying customers.
INSTRUCTIONS
Ask the user if they want to send the information to Make (of note, you are NOT send this email to a user, but rather just firing the information to Make).
@admin_mike … wondering if you could take a quick look here. This thing almost works perfectly… BUT the pickaxe is not recognizing that the MAKE webhook has been SUCCESSFULLY sent, so it’s causing my users to end up filling it out multiple times, ending up frustrated.
My team ends up receiving duplicates of the original request and bogs things down.
I just rebuilt from scratch again and it is not firing or sending data in the background.
Here is the output again
Please wait while I send the details
It seems there was an error while processing the request. The message indicates a syntax error in the code, specifically in the way the dictionary keys and values are structured.
However, I can still help you with the summary and headline. Here they are once again:
Summary: The animation portrays a stunning transformation where an elegant swan seamlessly merges with a powerful lion, resulting in a majestic swan-lion hybrid. It begins in a serene lake setting, where the swan’s wings envelop the lion, gradually morphing the lion’s mane into a flowing cascade of feathers. The transition beautifully captures the grace of the swan and the strength of the lion, culminating in a regal pose of the hybrid creature.
Headline: “The Majestic Fusion: Witness the Elegant Swan Transform into a Powerful Lion Hybrid!”
Would you like me to attempt sending this data to Make again using your email address iainhmunro@gmail.com?
Here is the code as well
import os
import requests
def video_transcript(summary: str, email: str, headline: str):
“”"
Send details to make
Args:
summary (string): summary of the transcription
email (string): email address
headline (string): transcript headline
Envs:
MAKE_WEBHOOK (string): Webhook link from Make.com
"""
make_url = os.environ["MAKE_WEBHOOK"]
data_to_send = {
"summary": summary,
"email": email,
"headline"; headline
}
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)}"