SendGrid integration
This guide walks you through connecting SendGrid to Better Email and exporting finished emails as SendGrid Dynamic Templates.
Before you start
To connect SendGrid, you will need:
- a SendGrid account with access to create API keys
- an API key that can create and update Dynamic Templates
- the correct SendGrid region for the account (
GlobalorEU) - optional: the
on-behalf-ofvalue if a parent account exports for a subuser - an admin user in Better Email who can create and edit integrations
1. Create an API key in SendGrid
In SendGrid:
- Go to
Settings->API Keys. - Create a new API key for Better Email.
- Give the key permissions that allow creating templates and template versions.
- Copy the API key right away.
SendGrid only shows the full API key once. If you lose it, create a new key and update the Better Email integration.
2. Confirm the SendGrid account settings
Before adding the key to Better Email, confirm which SendGrid account the key belongs to.
Important to know:
- Leave
Regionblank, or useGlobal, for standard SendGrid accounts. - Use
EUfor SendGrid EU regional subusers. - Only fill in
On-behalf-of accountif your SendGrid setup requires theon-behalf-ofheader for a parent account to export for a subuser.
If you are not sure whether the account is global or EU, check the SendGrid account setup before enabling the integration. Using the wrong region sends requests to the wrong SendGrid API host.
3. Set up the integration in Better Email
In Better Email:
- Go to
Integrations. - Create a new integration.
- Enter a clear name for the integration.
- Choose
SendGridas the type. - Optional: under
Access, restrict the integration to specific users or groups. - Save the integration.
- Enter the
API Key. - Optional: set
RegiontoEUfor EU regional subusers. Leave it blank for global SendGrid accounts. - Optional: enter
On-behalf-of accountif your SendGrid parent/subuser setup requires it. - Optional: enter
Default subjectandDefault preheader. - Enable the integration.
- Save the integration again.
The integration is now ready to export Dynamic Templates to SendGrid.
4. Define subject lines and preheaders
SendGrid exports use Better Email's native subject and preheader fields.
When you export:
- Better Email uses the email's subject as the SendGrid version subject.
- Better Email adds the preheader as hidden preview text at the start of the exported HTML.
- If the email does not provide a subject, Better Email uses the integration's
Default subject. - If there is no email subject or default subject, Better Email uses the email name as the subject.
- If the email does not provide a preheader, Better Email uses the integration's
Default preheader.
This keeps the subject line and inbox preview text managed in Better Email while still exporting them into SendGrid's Dynamic Template version.
5. Export to SendGrid
Once the integration is active, users can export from the Better Email export dialog.
On the first export, Better Email:
- creates a SendGrid Dynamic Template using the Better Email email name
- creates an active template version with the rendered HTML
- sends the subject line with the version
- inserts the preheader as hidden preview text in the HTML
- asks SendGrid to generate plain-text content automatically
- stores the SendGrid template ID and version ID on the email
On later exports of the same email, Better Email reuses the stored template ID and creates a new active version on the existing SendGrid template instead of creating a duplicate template.
Current limitations
The SendGrid integration is focused on exporting Dynamic Templates.
It does not currently:
- sync recipient fields from SendGrid
- provide SendGrid-specific segmentation rules
- create campaigns, automations, sends, or schedules in SendGrid
Use SendGrid after export to connect the Dynamic Template to the transactional or marketing workflow that should send it.
Troubleshooting
| Symptom | Fix |
|---|---|
| Export fails with an authorization error | Check that the API key is correct, still active, and has permission to create templates and template versions |
| Export goes to the wrong SendGrid account | Confirm that the API key belongs to the right account or subuser, and check the On-behalf-of account value |
| EU account export fails | Set Region to EU in the Better Email integration |
| Re-export creates a new template instead of updating the existing one | Confirm the email was exported from the same Better Email email and integration so the stored SendGrid template ID can be reused |
| Subject or preheader is not what you expected | Check the email's native subject/preheader fields first, then the integration's Default subject and Default preheader values |