From 3ce8e8d70a5a3ca102b55e70488b528bb61ed476 Mon Sep 17 00:00:00 2001 From: "ajaysi (aider)" Date: Tue, 17 Sep 2024 12:10:35 +0530 Subject: [PATCH] feat: implement personalized email composition for outreach based on website data and user proposals --- lib/ai_marketing_tools/ai_backlinking.py | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/lib/ai_marketing_tools/ai_backlinking.py b/lib/ai_marketing_tools/ai_backlinking.py index c8a1ec46..1f5e8c83 100644 --- a/lib/ai_marketing_tools/ai_backlinking.py +++ b/lib/ai_marketing_tools/ai_backlinking.py @@ -216,6 +216,41 @@ def find_backlink_opportunities(keyword): results.append(detailed_result) return results +def compose_personalized_email(website_data, insights, user_proposal): + """ + Compose a personalized outreach email based on website data, insights, and user proposal. + + Args: + website_data (dict): The data of the website including metadata and contact info. + insights (str): Insights generated by the LLM about the website. + user_proposal (str): The user's proposal for a guest post or content contribution. + + Returns: + str: A personalized email message. + """ + contact_name = website_data.get("contact_info", {}).get("name", "Webmaster") + site_name = website_data.get("metadata", {}).get("title", "your site") + proposed_topic = user_proposal.get("topic", "a guest post") + + email_body = f""" + Hi {contact_name}, + + I hope this message finds you well. I recently came across {site_name} and was impressed by the high-quality content you provide on {website_data.get("metadata", {}).get("keywords", "various topics")}. + + Based on the insights I gathered, I believe there is a great opportunity for collaboration. I would love to contribute {proposed_topic} that aligns with your site's focus and audience. + + Here are some insights and guidelines I gathered: + {insights} + + Please let me know if you are interested in discussing this further. I am excited about the possibility of working together and contributing to your site. + + Best regards, + [Your Name] + [Your Contact Information] + """ + + return email_body + def search_for_urls(query):