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

Add automatic company logo fetching during workspace creation #9158

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

samyakpiya
Copy link

Closes #9151

Description

This PR automatically sets a workspace's logo based on the user's work email domain during signup. When a user creates a new workspace using their work email (e.g., @airbnb.com), the system will fetch and set their company logo from twenty-icons.com as the default workspace logo.

Implementation Details

  • Added a new CompanyEnrichmentService to handle company-related data enrichment
  • Created a modular architecture that supports future enrichment features (e.g., company name, details)
  • Integrated with existing work email detection
  • Maintains user ability to override the logo later

Testing

twenty-9151.mp4

I tested the following scenarios:

  • Signing up with a work email (e.g., @company.com) → Logo is automatically set
  • Signing up with a personal email (e.g., @gmail.com) → No logo is set
  • User can still upload a custom logo after automatic setting

Technical Notes

  • Uses existing isWorkEmail utility
  • Structured for future extensibility (additional company data enrichment)
  • No breaking changes to existing functionality

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 automatic company logo fetching during workspace creation by integrating a new CompanyEnrichmentService that uses twenty-icons.com to fetch logos based on work email domains.

  • Added new CompanyEnrichmentService in /packages/twenty-server/src/engine/core-modules/company-enrichment/company-enrichment.service.ts with extensible architecture for future enrichment features
  • Integrated logo fetching in SignInUpService.signUpOnNewWorkspace() to automatically set workspace logos during creation
  • Service uses existing isWorkEmail utility to validate work domains before fetching logos
  • Added placeholder for future company data enrichment methods in CompanyEnrichmentService
  • Service follows twenty-icons.com URL pattern: https://twenty-icons.com/{domain}

💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!

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

Comment on lines 15 to 17
const domain = getDomainNameByEmail(email);

return `${this.TWENTY_ICONS_BASE_URL}/${domain}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

style: No error handling if domain extraction fails. Should wrap in try/catch to handle potential errors from getDomainNameByEmail.


const domain = getDomainNameByEmail(email);

return `${this.TWENTY_ICONS_BASE_URL}/${domain}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: URL should be URI encoded to handle special characters in domain names.

Comment on lines 338 to 339
const logoUrl =
await this.companyEnrichmentService.getCompanyLogoUrl(email);
Copy link
Contributor

Choose a reason for hiding this comment

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

style: consider adding error handling here in case the logo fetch fails to prevent workspace creation from failing

Copy link

github-actions bot commented Dec 19, 2024

Welcome!

Hello there, congrats on your first PR! We're excited to have you contributing to this project.
By submitting your Pull Request, you acknowledge that you agree with the terms of our Contributor License Agreement.

Generated by 🚫 dangerJS against 3c1c7f0

@FelixMalfait
Copy link
Member

Hey, this is a great PR. What you did was perfectly in line with the initial issue, but I kind of changed my mind halfway while reviewing your code. It might be over-engineering to introduce this enrichment service now and therefore I removed the company service to simplify things

@samyakpiya
Copy link
Author

Thanks for the review @FelixMalfait! I understand the decision to simplify the implementation. I've tested your simplified version and confirmed the logo appears correctly during sign-up.

Is there anything else needed from my side, or is this ready to be merged?

Let me know if there's anything else you'd like me to help with! 👍

@FelixMalfait
Copy link
Member

Thanks for testing it again @samyakpiya

Feel free to DM me on Discord, happy to point you to different things we're working on!

Copy link
Member

@FelixMalfait FelixMalfait left a comment

Choose a reason for hiding this comment

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

Great work!

@samyakpiya
Copy link
Author

Thanks Felix! Really enjoyed working on this feature. I've sent you a DM on Discord to discuss other areas where I can contribute. Looking forward to working on more issues! 🚀

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.

Load logo automatically during workspace
2 participants