mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-10 13:26:13 +00:00
Add support for managing audiences for new users
This commit is contained in:
@@ -16,6 +16,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
RESEND_API_KEY = os.getenv("RESEND_API_KEY")
|
RESEND_API_KEY = os.getenv("RESEND_API_KEY")
|
||||||
|
RESEND_AUDIENCE_ID = os.getenv("RESEND_AUDIENCE_ID")
|
||||||
|
|
||||||
static_files = os.path.join(settings.BASE_DIR, "static")
|
static_files = os.path.join(settings.BASE_DIR, "static")
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ async def send_welcome_email(name, email):
|
|||||||
|
|
||||||
html_content = template.render(name=name if not is_none_or_empty(name) else "you")
|
html_content = template.render(name=name if not is_none_or_empty(name) else "you")
|
||||||
|
|
||||||
r = resend.Emails.send(
|
resend.Emails.send(
|
||||||
{
|
{
|
||||||
"sender": "team@khoj.dev",
|
"sender": "team@khoj.dev",
|
||||||
"to": email,
|
"to": email,
|
||||||
@@ -49,6 +50,19 @@ async def send_welcome_email(name, email):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not RESEND_AUDIENCE_ID:
|
||||||
|
return
|
||||||
|
|
||||||
|
contact_params = {
|
||||||
|
"email": email,
|
||||||
|
"audience_id": RESEND_AUDIENCE_ID,
|
||||||
|
}
|
||||||
|
|
||||||
|
if name:
|
||||||
|
contact_params["first_name"] = name
|
||||||
|
|
||||||
|
resend.Contacts.create(contact_params)
|
||||||
|
|
||||||
|
|
||||||
async def send_query_feedback(uquery, kquery, sentiment, user_email):
|
async def send_query_feedback(uquery, kquery, sentiment, user_email):
|
||||||
if not is_resend_enabled():
|
if not is_resend_enabled():
|
||||||
|
|||||||
Reference in New Issue
Block a user