SendGrid Integration
Email delivery via SendGrid.
Configuration
json
{
"credentials": {
"sendgrid": {
"apiKey": "{{env.SENDGRID_API_KEY}}",
"fromEmail": "noreply@example.com",
"fromName": "My App"
}
}
}Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /integrations/sendgrid/send | Send email |
Actions (for workflows)
sendEmail
json
{
"integration": "sendgrid",
"action": "sendEmail",
"params": {
"to": "user@example.com",
"subject": "Welcome!",
"html": "<h1>Welcome</h1><p>Thanks for signing up!</p>"
}
}sendTemplate
json
{
"integration": "sendgrid",
"action": "sendTemplate",
"params": {
"to": "user@example.com",
"templateId": "d-abc123",
"dynamicTemplateData": {
"name": "{{input.name}}",
"orderNumber": "{{input.orderId}}"
}
}
}Examples
Send Simple Email
bash
curl -X POST http://localhost:3000/integrations/sendgrid/send \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"to": "user@example.com",
"subject": "Order Confirmation",
"html": "<h1>Order Confirmed</h1><p>Your order has been placed.</p>"
}'Send with Template
bash
curl -X POST http://localhost:3000/integrations/sendgrid/send \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"to": "user@example.com",
"templateId": "d-abc123",
"dynamicTemplateData": {
"name": "John",
"orderNumber": "12345"
}
}'In Routes
json
{
"path": "/signup",
"method": "post",
"supabaseQueries": [{
"table": "users",
"operation": "insert",
"data": {
"email": "{{body.email}}",
"name": "{{body.name}}"
}
}],
"integrations": [{
"type": "sendgrid",
"action": "sendEmail",
"params": {
"to": "{{body.email}}",
"subject": "Welcome to Our App",
"html": "<h1>Welcome, {{body.name}}!</h1>"
}
}]
}Workflow Example
json
{
"id": "order-confirmation",
"steps": [
{
"id": "send-email",
"type": "integration",
"integration": "sendgrid",
"action": "sendTemplate",
"params": {
"to": "{{input.email}}",
"templateId": "d-order-confirmation",
"dynamicTemplateData": {
"orderNumber": "{{input.orderId}}",
"items": "{{input.items}}",
"total": "{{input.total}}"
}
}
}
]
}Email Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient email |
subject | string | Yes* | Email subject |
html | string | Yes* | HTML body |
text | string | No | Plain text body |
templateId | string | Yes* | SendGrid template ID |
dynamicTemplateData | object | No | Template variables |
from | string | No | Override sender |
replyTo | string | No | Reply-to address |
*Either subject+html or templateId required.