Skip to content

Commit

Permalink
Small update to also record when welcome email is sent for future use
Browse files Browse the repository at this point in the history
  • Loading branch information
gregv committed Jul 30, 2024
1 parent 080d2c8 commit fd2775f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/messages/messages_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,13 @@ async def save_lead(json):
slack_message = f"New lead! Name:`{json['name']}` Email:`{json['email']}`"
send_slack(slack_message, "ohack-dev-leads")

send_welcome_email( json["name"], json["email"] )
success_send_email = send_welcome_email( json["name"], json["email"] )
if success_send_email:
logger.info(f"Sent welcome email to {json['email']}")
# Update db to add when email was sent
collection.document(insert_res[1].id).update({
"welcome_email_sent": datetime.now().isoformat()
})
return True

# Create an event loop and run the save_lead function asynchronously
Expand Down Expand Up @@ -926,6 +932,7 @@ def send_welcome_email(name, email):
email = resend.Emails.SendParams(params)
resend.Emails.send(email)
print(email)
return True


@cached(cache=TTLCache(maxsize=100, ttl=32600), key=lambda news_limit, news_id: f"{news_limit}-{news_id}")
Expand Down

0 comments on commit fd2775f

Please sign in to comment.