sendgrid use email templates
I would like to use the email templates in sendgrid so that it easier to reform the templates without deployment and isolated place to maintain these.
however I find the emailSender from 'wasp/server/email` only allows the type that is for emails where html and text versions are mandatory
2 Replies
Hi @p4j4r5. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information provided in the knowledge sources, I understand your desire to use SendGrid email templates for easier maintenance and reformatting without deployment. However, the current implementation of Wasp's email sending functionality does not directly support using SendGrid-specific features like email templates.
The current
emailSender
API in Wasp requires both html
and text
versions of the email content to be provided when sending an email, as shown in the JavaScript API documentation (https://wasp-lang.dev/docs/advanced/email#javascript-api). This API doesn't have built-in support for SendGrid-specific features like template IDs.
There is an open GitHub issue addressing this limitation: Allow specifying provider specific options, like templateId for Sendgrid (https://github.com/wasp-lang/wasp/issues/1553). This issue acknowledges the need to allow provider-specific options, including SendGrid's templateId
and dynamicTemplateData
.
For now, there isn't a direct way to use SendGrid templates with Wasp's emailSender
. As a workaround, you might consider:
1. Using Wasp's current email sending capabilities and managing your templates within your application code.
2. Using a job queue to schedule emails and implementing a custom solution using SendGrid's Node.js library directly, as suggested in a Discord support thread (https://discord.com/channels/686873244791210014/1179895919471247490).
Keep an eye on the GitHub issue for updates on when this feature might be implemented. In the meantime, you'll need to work within the constraints of the current API or implement a custom solution outside of Wasp's emailSender
.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @p4j4r5, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Alright then. I may need to stick to defining templates within App, which isn't efficient for maintenance and wish I could use templates that are already defined.