SendGrid Setup
Connect your SendGrid account to Optail.
Prerequisites
- A SendGrid account
- A verified sending domain in SendGrid
1. Generate an API Key
- Log in to the SendGrid dashboard
- Go to Settings > API Keys
- Click Create API Key
- Select Restricted Access and enable:
- Mail Send > Full Access
- Tracking > Read Access (for webhook events)
- Copy the API key (it is only shown once)
2. Connect in Optail
Via Dashboard
- Go to Providers > Connect Provider
- Select SendGrid
- Enter a display name (e.g., "SendGrid Production")
- Paste your API key
- Click Connect -- Optail validates the key by calling SendGrid's API
Via API
curl -X POST https://api.optail.io/v1/providers \
-H "Authorization: Bearer ms_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"providerType": "SENDGRID",
"displayName": "SendGrid Production",
"credentials": {
"apiKey": "SG.xxxxxxxxxxxxxxxxxxxxx"
}
}'
3. Verify Your Sending Domain
If you have not already verified your domain in SendGrid:
- In SendGrid, go to Settings > Sender Authentication > Domain Authentication
- Follow the DNS record setup (CNAME records)
- Wait for DNS propagation (usually under 1 hour)
Optail checks domain verification status when sending. Unverified domains may still work depending on your SendGrid account settings, but verified domains improve deliverability.
4. Configure Webhooks (Optional)
To receive delivery events (delivered, opened, bounced, etc.) in Optail:
- In SendGrid, go to Settings > Mail Settings > Event Webhook
- Set the HTTP POST URL to:
https://webhooks.optail.io/v1/ingest/sendgrid - Select the events you want to track:
- Delivered, Opened, Clicked, Bounced, Spam Report, Unsubscribe, Dropped, Deferred
- Enable the webhook
Optail normalizes SendGrid events into its unified event format and updates message status automatically.
Credential Reference
| Field | Description |
|---|---|
apiKey | SendGrid API key starting with SG. |