Configuring the SendGrid integration

Overview

To send emails through gaiia, you need to connect an external email provider. This article walks you through setting up SendGrid, a cloud-based email delivery service, as that provider. You create a SendGrid account, authenticate your domain, turn off click tracking, create an API key, and connect it all to gaiia.

We recommend a paid SendGrid subscription. Free plans have a low sending quota, and once it is reached SendGrid stops delivering emails to your customers.

Setting up your SendGrid integration

Follow these steps in order. Steps 1 to 4 happen in SendGrid; step 5 happens in gaiia.

Step 1 – Create your SendGrid account

If you don’t already have a SendGrid account, create one: https://signup.sendgrid.com/

Step 2 – Authenticate your domain

Domain authentication makes your emails appear trusted, so they don’t get flagged as spam. Follow SendGrid’s guide to set it up: https://docs.sendgrid.com/ui/account-and-settings/how-to-set-up-domain-authentication

Step 3 – Disable click tracking

Do not skip this step. When click tracking is on, SendGrid replaces the links in your emails with its own tracking links. Customers who click them get security errors in most modern browsers, and the links do not open the intended page (payment links, client portal invitations, etc.).

Turn off click tracking in your SendGrid account before sending any communications from gaiia.

  1. Log in to your SendGrid account.

  2. Go to Settings > Tracking.

  3. Open Click Tracking and switch it off.

  4. Save your changes.

For more details, see SendGrid’s tracking settings guide: https://www.twilio.com/docs/sendgrid/ui/account-and-settings/tracking

Already sent emails with click tracking on? Disabling the setting does not fix emails that were already delivered, because they still contain the tracked links. After you disable click tracking, resend the affected communications to your customers.

Step 4 – Create an API key

Create an API key in SendGrid for gaiia to use: https://docs.sendgrid.com/ui/account-and-settings/api-keys

The key needs the following permissions for the integration to work:

mail.send
user.webhooks.event.settings.create
user.webhooks.event.settings.read
user.webhooks.event.settings.update
sender_verification_eligible
whitelabel.read

Keys created with a longer permission list, including the mail.batch and user.webhooks.parse permissions, keep working. gaiia does not use those permissions.

Copy the key when SendGrid shows it. You need it in the next step.

Step 5 – Connect SendGrid in gaiia

Once your domain is authenticated and your API key is ready, link SendGrid to gaiia.

  1. Go to the Integrations page: https://app.gaiia.com/[your tenant slug]/admin/integrations

  2. Click Install next to SendGrid.

  3. Provide the required information:

    • SendGrid API Key: the key you created in step 4.

    • Default sender email: the address emails are sent from, such as support@mydomain.com. You can also include a sender name: My Custom Name <support@mydomain.com>

When you install the integration, gaiia registers an event webhook in your SendGrid account. SendGrid uses it to report whether each email was delivered, bounced or dropped.

Updating the integration

You can update this configuration at any time from the Integrations page. Only the fields you change are saved.

  • Default sender email: edit it directly. Your API key stays as it is.

  • SendGrid API Key: the field is empty when you edit the integration. Leave it empty to keep the current key, or enter a new key to replace it.

gaiia checks the configuration with SendGrid again when you save, so the issues listed under Troubleshooting can also come up during an update.

Confirming the integration works as expected

The best way to test the integration is to generate an invoice for an account. Make sure the Statement communication template and the statement document are set up first. gaiia should then:

  • Send an email to the account’s contact information.

  • Attach the invoice as a PDF.

  • Mark the notification as "Delivered" in the account’s Communication tab.

Troubleshooting

If installing or updating the integration fails, check these causes in SendGrid:

  • The API key is missing the Event Webhook permission. Edit the key and grant the user.webhooks.event.settings permissions listed in step 4, then install the integration again.

  • The SendGrid account has reached its maximum number of event webhooks. Go to Settings > Mail Settings > Event Webhooks, delete a webhook you no longer use, then install the integration again.

  • A sender address isn't verified with SendGrid. When you save the integration, gaiia checks the sender identity and any new sender address with SendGrid. The same check runs when you save the reply address of a ticket mailbox. If an address isn't verified, gaiia shows the message Sender address "address" is not verified with the email provider and saves nothing. Verify the address or its domain in SendGrid, then save again.

  • gaiia can't reach SendGrid. The message Could not reach the email provider to verify the sender addresses. Nothing was saved, please try again. means SendGrid didn't answer in time. Try again in a few minutes.