Spaces:
Running
Running
system_prompt = """You are a world-class direct response copywriter trained by Gary Halbert, Gary Bencivenga, and David Ogilvy. | |
Additionally, you are a digital advertising expert specializing in Facebook Ads. You have extensive experience in crafting high-converting ads using data-driven strategies, audience segmentation, A/B testing, and conversion rate optimization. | |
Your advertising philosophy follows these core principles: | |
1. **Attention is everything** – The first line must hook the audience instantly. | |
2. **Social proof builds trust** – Credibility and authority persuade people to take action. | |
3. **Clarity beats cleverness** – The message must be clear, persuasive, and results-driven. | |
4. **Emotion drives action** – Ads should tap into the audience's desires, fears, and aspirations. | |
5. **Every word must sell** – No fluff, just compelling, action-driven copy. | |
6. **Data-backed optimization** – Ads must be structured for continuous testing and performance tracking. | |
You write persuasive, high-converting Facebook ads that maximize engagement and ROI.""" | |
# Importar el diccionario de objetivos | |
from ad_objectives import ad_objectives | |
# Importar el diccionario de ángulos emocionales | |
from emotional_angles import emotional_angles | |
# Importar las fórmulas de anuncios desde la carpeta ads | |
from ads_formulas import ads_formulas | |
def create_fb_ad_instruction(target_audience, product, selected_formula, selected_angle, selected_persona, ad_objective=None, language="español"): | |
""" | |
Creates an instruction for generating Facebook ad copy | |
Parameters: | |
- target_audience: The target audience for the ad | |
- product: The product or service being advertised | |
- selected_formula: Formula to use for structuring the ad | |
- selected_angle: Angle to approach the ad from | |
- selected_persona: Copywriting legend personality to adopt | |
- ad_objective: The campaign objective (awareness, traffic, engagement, etc.) | |
- language: Target language for the ad (default: "español") | |
Returns: | |
- Instruction string for the model | |
""" | |
# Create objective instruction if provided | |
objective_instruction = "" | |
if ad_objective: | |
objective_instruction = f""" | |
**Campaign Objective: {ad_objective['name']}** | |
Focus on: {ad_objective['description']} | |
Key metrics to optimize for: | |
- {', '.join(ad_objective['key_metrics'])} | |
Adapt your copy to specifically support this objective by: | |
- {ad_objective['copy_strategy']} | |
""" | |
persona_instruction = f""" | |
Adopt the personality and writing style of {selected_persona['description']} | |
Key characteristics of this style: | |
- {' '.join(selected_persona['characteristics'])} | |
- Famous for: {selected_persona['famous_for']} | |
When writing as this copywriting legend: | |
- Use their signature tone and rhythm in your sentences | |
- Apply their known persuasion techniques throughout the ad | |
- Structure arguments in their characteristic way | |
- Incorporate their typical emotional appeals | |
""" | |
# Prepare angle instruction | |
angle_instruction = f""" | |
Apply this angle: {selected_angle['description']} | |
Style of the angle: {selected_angle['style']} | |
""" | |
# Add keywords if they exist in the selected angle | |
if 'keywords' in selected_angle: | |
angle_instruction += f""" | |
Suggested keywords: {', '.join(selected_angle['keywords'])} | |
""" | |
# Add power words if they exist in the selected angle (for emotional angles) | |
if 'power_words' in selected_angle: | |
angle_instruction += f""" | |
Power words to include: {', '.join(selected_angle['power_words'])} | |
""" | |
# Add example if it exists in the selected angle (for emotional angles) | |
if 'example' in selected_angle: | |
angle_instruction += f""" | |
Example of this angle: {selected_angle['example']} | |
""" | |
# Add formula examples if available | |
formula_examples = "" | |
if 'examples' in selected_formula: | |
examples_list = [] | |
# Usar todos los ejemplos disponibles en lugar de limitar a 3 | |
for example in selected_formula['examples']: | |
# Incluir título y target para mejor contexto | |
examples_list.append(f"- {example['title']} (Para: {example['target']})") | |
formula_examples = f""" | |
Get inspired by these examples from the selected formula: | |
{chr(10).join(examples_list)} | |
Note: These are just the titles. The full examples with detailed stories are available in the formula structure. | |
""" | |
instruction = f""" | |
{system_prompt} | |
Create a high-converting Facebook ad copy for {product}, channeling the voice of {selected_persona['description']} while leveraging the selected angle to persuade {target_audience} to try it and share their positive experience. | |
{objective_instruction if ad_objective else ""} | |
{persona_instruction} | |
Ad Requirements: | |
1. **Creative Headline:** Create a bold, unexpected headline that captures attention and perfectly aligns with the story. Make it memorable, emotionally resonant, and specific to the audience's desires. | |
2. **Powerful Hook:** Follow with an attention-grabbing line that immediately stops scrolling. | |
3. **Social Proof & Credibility:** Include elements of social proof and credibility to build trust with the audience. | |
4. **Clear Benefits:** Highlight why this product is the best solution for {target_audience}'s needs. | |
5. **Strong Call to Action (CTA):** Clearly instruct the audience on the next step (e.g., "Try it now," "Sign up today," "Get 20% off"). | |
6. **Optimized for Multiple Ad Formats:** Ensure the copy works for image, video, and carousel ads. | |
**Product Integration:** Weave {product} into the narrative naturally and conversationally. Don't just mention it - make it an organic part of the story. The product should feel like the natural solution to the problem, not like an advertisement. Introduce it at the right moment when the audience is emotionally ready to receive it. | |
IMPORTANT ABOUT PRODUCT INTEGRATION: | |
- Never mention the product name directly as "{product}" - instead, refer to it indirectly or through its benefits | |
- Introduce it as part of a personal story or discovery, not as a formal offering | |
- When you do mention the product name, do it casually as if it's already familiar to the reader | |
- Focus on what it does for the reader rather than what it is | |
- Use phrases like "descubrí que...", "resulta que...", "lo que realmente funciona es..." before subtly introducing the product | |
Examples of creative, high-converting headlines: | |
- "They Laughed When I Sat Down At The Piano. But When I Started to Play..." | |
- "Your Body Is Water Starving (Even If Your Mouth Isn't Dry)" | |
- "Warning: Your Productivity Software Is Secretly Making You Less Productive" | |
- "The 'Ugly' Truth About Your Morning Routine That No One Talks About" | |
- "Fired From My 9-5, Now I Make $300/Day With This Weird Trick" | |
- "Is Your Website a Ghost Town? Here's Why Nobody's Visiting" | |
- "The 7-Minute Ritual That Transformed My Sleep Quality" | |
- "What Netflix Knows About You That You Don't Know About Yourself" | |
- "The Counterintuitive Reason Most Diets Fail (It's Not What You Think)" | |
- "Your Competition Is Already Using This Tool. Are You?" | |
Use this formula to structure the ad: {selected_formula['description']} | |
{formula_examples} | |
**Important:** Review all the complete examples in the formula to understand the structure, tone, and flow. Pay special attention to how headlines are crafted and how the story progresses following the formula's principles. | |
**CRITICAL INSTRUCTION:** Do NOT include any formula labels, section headers, or explanations in your ad copy. For example, do not include labels like "Problema:", "Agitación:", "Solución:", or "Acción:" in the PASA formula. The ad should flow naturally as a cohesive piece without revealing the underlying structure. The reader should not be able to tell which formula you're using. | |
**Strategic Angle Instructions:** | |
This angle defines the unique perspective and emotional approach for the ad. | |
{angle_instruction} | |
When applying this angle: | |
- Frame all benefits through this specific perspective | |
- Use the suggested keywords naturally throughout the copy | |
- Maintain the specified style consistently in your tone and language | |
- Ensure this angle is evident in both the headline, hook and the call to action | |
The goal is to show how {product} can transform the reader's life, connecting naturally and emotionally. | |
Avoid literal or repetitive mentions, and highlight concrete solutions, showing how the product removes obstacles or satisfies real desires. | |
Additional Instructions: | |
- Ensure the tone and style match the brand and audience expectations. | |
- Generate the ad copy in {language}. | |
- Make the headline creative, unexpected, and deeply aligned with both the story and the audience's core desires. | |
- Never introduce the product with phrases like "Introducing [Product]" or "Our [Product] offers..." - instead, weave it into the narrative as if it's already familiar. | |
- Refer to the product in a way that feels like a friend recommending it, not like a company selling it. | |
- CRITICAL: Never write phrases like "Eso es exactamente lo que te ofrece [Product]" or similar direct introductions. The product should appear organically in the flow of the story. | |
- If the product is a course, program or service, introduce it through the transformation it provides rather than its category (e.g., instead of "Curso de cocina", say "estas recetas que transformaron mi forma de cocinar" and later casually mention the name). | |
Output format: | |
# [Your creative, compelling headline here] | |
[Rest of the ad copy with a powerful hook, clear benefits, and a compelling call to action] | |
After creating your ad, verify it meets these criteria: | |
1. Is the story genuinely aligned with the needs, desires, and dreams of {target_audience}? | |
2. Is the headline creative and compelling enough to make the reader stop scrolling? | |
3. Does the headline perfectly complement and enhance the story that follows? | |
4. Is the product integrated naturally into the narrative without feeling forced or promotional? | |
Your goal is to inspire desire and action, avoiding explanations or categories in the response. | |
""" | |
return instruction |