| name | sendgrid |
| slug | sendgrid-integration |
| version | 1.0.0 |
| category | integration |
| description | SendGrid email integration with templates and transactional email support |
| triggers | [object Object] |
| mcp_dependencies | [object Object] |
SendGrid Integration Skill
Complete SendGrid email integration template with email client setup, reusable templates, and transactional email functionality.
Overview
This template includes:
- SendGrid Client Setup - Server-side SendGrid SDK configuration
- Email Templates - Pre-built welcome and notification templates
- Type Safety - Full TypeScript support
- Error Handling - Comprehensive email delivery tracking
- Template System - Reusable HTML email templates
When to Use This Template
Use this template when you need:
- Transactional email sending
- Welcome email flows
- Notification emails
- Password reset emails
- Email verification
- Custom email templates
What's Included
Code Files
code/client.ts- SendGrid SDK setup and email utilitiescode/templates/welcome.ts- Welcome email templatecode/templates/notification.ts- Notification email template
Configuration
mcp/config.json- MCP server configuration for SendGridenv/.env.template- Required environment variables
Documentation
docs/README.md- Complete setup and usage guide
Quick Start
Install Dependencies
npm install @sendgrid/mailConfigure Environment Variables
cp templates/sendgrid/env/.env.template .env.local # Add your SendGrid API keyCopy Template Files
npx tsx scripts/load-template.ts sendgridVerify Sender Email
- Go to SendGrid Dashboard
- Add and verify sender email address
Key Features
1. Send Transactional Emails
import { sendEmail } from '@/lib/sendgrid/client'
await sendEmail({
to: 'user@example.com',
subject: 'Welcome to our app!',
text: 'Thanks for signing up.',
html: '<strong>Thanks for signing up!</strong>',
})
2. Use Email Templates
import { sendWelcomeEmail } from '@/lib/sendgrid/templates/welcome'
await sendWelcomeEmail({
to: 'user@example.com',
name: 'John Doe',
loginUrl: 'https://app.example.com/login',
})
3. Send Notifications
import { sendNotificationEmail } from '@/lib/sendgrid/templates/notification'
await sendNotificationEmail({
to: 'user@example.com',
title: 'New Message',
message: 'You have received a new message.',
actionUrl: 'https://app.example.com/messages',
actionText: 'View Message',
})
4. Batch Email Sending
import { sendBulkEmail } from '@/lib/sendgrid/client'
await sendBulkEmail({
to: ['user1@example.com', 'user2@example.com'],
subject: 'Newsletter',
html: '<p>Monthly newsletter content</p>',
})
Email Templates
Welcome Email
Professional welcome email with call-to-action button.
Notification Email
Generic notification template for alerts and updates.
Custom Templates
Create custom templates following the same pattern:
export async function sendCustomEmail(params: {
to: string
// ... custom params
}) {
return sendEmail({
to: params.to,
subject: 'Custom Subject',
html: generateHtmlTemplate(params),
})
}
Security Best Practices
- Never expose API keys client-side
- Validate recipient email addresses
- Implement rate limiting
- Use unsubscribe links
- Handle bounces and spam reports
Testing
Test Mode
SendGrid provides a sandbox mode for testing:
const client = sendgrid()
client.setApiKey(process.env.SENDGRID_API_KEY!)
client.setSandboxMode(true) // Enable sandbox
Email Validation
Always validate emails before sending:
import { isValidEmail } from '@/lib/sendgrid/utils'
if (!isValidEmail(email)) {
throw new Error('Invalid email address')
}
Resources
Template Version: 1.0.0 Last Updated: 2026-01-04 Maintainer: Turbocat Agent System