Sendgrid

Sendgrid is an SMTP provider that works great with Easystart for sending emails. Using Sendgrid in Easystart is easy.

To get started, create an account on Sendgrid. Then, validate a sender or domain for email delivery. This step is important to prevent requests from being blocked. After that, request a secret key.

Once you have created your account at Sendgrid and have the secret key, go to the GlobalSettings section of the Administrative Panel and enable the email provider.

../../_images/EmailProviderEnable.png

The Email Provider section in the side menu will be activated. When you go to that section, you will notice that Sendgrid is already set as the default provider.

../../_images/EmailProviderList.png

By clicking on the edit icon (pencil), you will be able to access the edit form where you can enter the secret key obtained in Sendgrid.

../../_images/EmailProviderEdit.png

Then in Sendgrid, you must upload the transactional emails (in both English and Spanish) and save the template IDs that they generate. In Sendgrid, you should see something like this:

../../_images/SendgridTemplates.png

Go to the list of providers and click on the template icon (schema) to see the default templates for both English and Spanish versions of the five transactional email templates. Then, make sure to set all the template IDs for each template.

../../_images/EmailProviderTemplates.png

Additionally, you must fill in the Company Information details since the social media and address data displayed in the emails are extracted from there.

../../_images/CompanyInformation.png

This is it. Congratulations 🎉, you have successfully integrated Sendgrid into your app.

How Sendgrid integration works

Every time an email notification event is generated, Easystart makes a request to Sendgrid indicating the template_id (to specify which template to use) and the data to be inserted into the templates. You can see the designs in the Transactional Emails section.

The data structure must be in JSON format. An example for sending an email from the Confirm Email template is as follows:

{
    "template_settings":{
      "banner_color": "#FFFFFF",
      "color_primary": "#22C55E"
    },
    "company":{
        "site_name": "Easystart",
        "tag_line": "Made with ❤️ from Easystart",
        "site_url": "https://starthere-ventures.github.io/easystart-landing/",
        "site_logo_url": "https://starthere-ventures.github.io/easystart-assets/images/logo.png",
        "trademark": "Easystart",
        "business_name": "Easystart Inc",
        "address_line1": "2093 PHILADELPHIA PIKE #6325",
        "address_line2": "CLAYMONT, DE 19703",
        "city": "Delaware",
        "country": "USA",
        "social_network":{
            "twitter_user": "@easystartapp",
            "facebook_user": "easystartapp",
            "telegram_user": "easystartapp",
            "linkedin_user": "easystartapp",
            "youtube_user": "easystartapp",
            "instagram_user": "easystartapp"
        }
    },
    "operation":{
        "client_name": "Jose Morales",
        "callback_url": "www.ejemplo.com/confirm/confirmacion.correo-d/htfrs-addd12345"
    }
}

The values of the template settings are registered in the EmailProvider model, while the company information data is set in the Company Information module. The operation flag is specific data that distinguishes each template.