datadabllp

Personalized Email Campaigns

Jul 19th, 2024 (edited)
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.24 KB | None | 0 0
  1. def generate_personalized_email(customer_data, travel_trends):
  2.     prompt = f"""
  3.    Generate a personalized email for a travel company customer with the following profile:
  4.    - Name: {customer_data['name']}
  5.    - Past destinations: {', '.join(customer_data['past_destinations'])}
  6.    - Preferred travel style: {customer_data['travel_style']}
  7.    - Budget: ${customer_data['budget']}
  8.  
  9.    Current travel trends:
  10.    {travel_trends}
  11.  
  12.    The email should include:
  13.    1. A personalized greeting
  14.    2. 2-3 travel recommendations based on the customer's profile and current trends
  15.    3. A brief explanation of why each recommendation suits the customer
  16.    4. A call-to-action to book a trip
  17.  
  18.    Keep the tone friendly and engaging.
  19.    """
  20.    
  21.     response = llm.generate(prompt)
  22.     return response.text
  23.  
  24. # Example usage
  25. customer = {
  26.     "name": "Emma",
  27.     "past_destinations": ["Japan", "Italy", "Mexico"],
  28.     "travel_style": "cultural experiences",
  29.     "budget": 5000
  30. }
  31.  
  32. travel_trends = """
  33. - Sustainable tourism is on the rise
  34. - Off-the-beaten-path destinations are gaining popularity
  35. - Wellness retreats are trending
  36. """
  37.  
  38. personalized_email = generate_personalized_email(customer, travel_trends)
  39. print(personalized_email)
  40.  
Advertisement
Add Comment
Please, Sign In to add comment