Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: customer io email support #28578

Merged
merged 24 commits into from
Feb 19, 2025

Conversation

zlwaterfield
Copy link
Contributor

@zlwaterfield zlwaterfield commented Feb 11, 2025

Changes

We're consolidating email sending into customer.io so moving off Mailgun. Billing emails are already using this and it's working well. This is adding the basic setup.

This is also implementing the first 3 emails for 2FA auth and adding backup HTML SMTP email templates.

Waiting on https://github.com/PostHog/charts/pull/3393

RFC for more info: https://github.com/PostHog/product-internal/blob/main/requests-for-comments/2024-12-12-posthog-emails-customer-io.md

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

Built this as an alternative to the existing STMP

How did you test this code?

Added a few unit tests

@zlwaterfield zlwaterfield self-assigned this Feb 11, 2025
@zlwaterfield zlwaterfield marked this pull request as ready for review February 12, 2025 00:09
@zlwaterfield zlwaterfield requested a review from a team February 12, 2025 00:09
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR introduces Customer.io as a new email service provider, replacing Mailgun for transactional emails, with implementation focused on API integration and backward compatibility with existing SMTP functionality.

  • Added Customer.io API integration in /posthog/email.py with new _send_via_http function and service availability checks
  • Implemented Decimal to float conversion in /posthog/email.py for proper JSON serialization in Customer.io payload
  • Added CUSTOMER_IO_API_KEY configuration in /ee/settings.py for enterprise deployment support
  • Added comprehensive HTTP-based email sending tests in /posthog/test/test_email.py covering API authentication and data handling
  • Maintained backward compatibility by preserving SMTP functionality with a use_http toggle flag

3 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

@joshsny joshsny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be great to have everything in Customer.io!

Left a couple questions about their API

Copy link
Contributor

@joshsny joshsny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📬

@zlwaterfield zlwaterfield force-pushed the zach/customer-io-transactional-emails-1 branch from 5a021bb to 1fbc2a0 Compare February 13, 2025 15:33
@zlwaterfield zlwaterfield requested a review from joshsny February 13, 2025 20:37
@zlwaterfield
Copy link
Contributor Author

@joshsny I made a bunch of updates here, could I grab another review?

I wanted to add backup templates for self hosters.

Copy link
Contributor

@joshsny joshsny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome 🚀

@zlwaterfield zlwaterfield merged commit 174928a into master Feb 19, 2025
93 checks passed
@zlwaterfield zlwaterfield deleted the zach/customer-io-transactional-emails-1 branch February 19, 2025 15:12
slshults pushed a commit that referenced this pull request Feb 19, 2025
Co-authored-by: Joshua Snyder <[email protected]>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants