Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Email sending

A lot of processes in Wisk trigger an email to be sent to the user. When this happens, the message service is used.

Message Service

The project taking care of messaging in Wisk is https://github.com/WiskSolutions/wisk-messaging

It’s written in Kotlin and it’s basically a wrapper around Sendgrid (https://sendgrid.com/).

Wisk API will prepare the content of the email and call this message service to do the sending.

Templates

To avoid having all possible email templates in code, there’s an Airtable (https://airtable.com/) workspace (called Sendgrid templates) where all the templates are created. Those templates can receive parameters to make the emails customizable for the user and the specific data needed.

img_3.png

Wisk API code for sending an email always reference an Airtable template and will pass the needed parameters.

Sendgrid

The actual emails are being sent using SendGrid

            val templateId = "d-e3d8614faee2400bbff1295e393df9b4"

            val message = Message(
                    subject = template.subject,
                    data = data,
                    fromEmail = template.senderEmail ?: "support@wisk.ai",
                    fromName = template.senderName ?: "WISK.ai",
                    replyEmail = replyEmail,
                    domain = "wisk.ai",
                    template = templateId)

The templates can be found in the Sendgrid UI img_10.png

the wisk-messaging populates the template with the data passed in the request img_12.png You can play with the test data in the Sendgrid UI (notice that “ is escaped with ") img_13.png