twilio-sendgrid-account-setup
Set up a SendGrid account for email delivery. Covers API key creation (SG.-prefix), domain authentication (DKIM/SPF via CNAME records), Single Sender Verification for testing, SDK installation, and the relationship between SendGrid and Twilio credentials. Use before any other SendGrid skill. This sk
- 0
- Installs
- —
- Rating
- —
- Success rate
- 2
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 d07cc2f6cc235dd0… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
Overview
SendGrid is Twilio's email delivery engine but uses a completely separate authentication system — SendGrid API keys (starting with SG.) are not Twilio API keys. You cannot use Account SID/Auth Token for SendGrid, and no Twilio MCP tools wrap SendGrid.
Quickstart
- Get your API key from SendGrid Console > Settings > API Keys
- Set environment variable:
export SENDGRID_API_KEY=SG.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- Install SDK:
| Language | Install | Package |
|---|---|---|
| Python | pip install sendgrid | sendgrid |
| Node.js | npm install @sendgrid/mail | @sendgrid/mail (v8.x) |
| Java | Maven | com.sendgrid:sendgrid-java |
| C# | dotnet add package SendGrid | SendGrid |
| Ruby | gem install sendgrid-ruby | sendgrid-ruby |
| PHP | composer require sendgrid/sendgrid | sendgrid/sendgrid |
| Go | go get github.com/sendgrid/sendgrid-go | sendgrid-go |
- Authenticate your sending domain (see below)
API Key Scopes
| Scope | Use for | Risk |
|---|---|---|
| Full Access | Development only | Can do everything — never deploy with this |
| Restricted Access | Production | Scope to only what your app needs (e.g., Mail Send only) |
| Billing Access | Account management | Separate from mail operations |
A "Mail Send" restricted key can send email but cannot read suppressions, manage templates, or access stats. If you get 403 Forbidden, check key permissions.
SMTP Relay (Alternative to API)
SendGrid also supports SMTP for sending. Useful for frameworks with built-in SMTP support (e.g., Laravel, Django, Rails).
| Setting | Value |
|---|---|
| Server | smtp.sendgrid.net |
| Port | 587 (TLS) or 465 (SSL) |
| Username | apikey (literal string, not your key name) |
| Password | Your SendGrid API key (SG.xxx) |
Domain Authentication (Required for Production)
Single Sender Verification is for testing only. Production requires domain authentication for deliverability.
Setup: SendGrid Console > Settings > Sender Authentication > Authenticate Your Domain
Create 3 CNAME DNS records:
s1._domainkey.yourdomain.com→s1.domainkey.u1234.wl.sendgrid.net(DKIM)s2._domainkey.yourdomain.com→s2.domainkey.u1234.wl.sendgrid.net(DKIM)em1234.yourdomain.com→u1234.wl.sendgrid.net(return path)
Verify via API: GET /v3/whitelabel/domains/{id}/validate
DMARC: After setting up DKIM and SPF via domain authentication, configure a DMARC DNS record (_dmarc.yourdomain.com) to instruct receiving servers how to handle authentication failures. Start with p=none for monitoring before enforcing.
Dedicated IP (Pro+ plans): Isolates your sending reputation. Requires an IP warming schedule — start with low volume and increase over 30 days.
SendGrid and Twilio
| Twilio product | How it uses SendGrid | Sends email? |
|---|---|---|
| SendGrid (this skill) | Direct email delivery via api.sendgrid.com | Yes |
| Twilio Email API | Direct email delivery via comms.twilio.com/v1/emails — uses Twilio creds, not SendGrid keys | Yes (separate product) |
| Verify | OTP via channel: 'email' | Delegates to SendGrid via Mailer config |
| Conversations | Tracks EMAIL as a channel type | No — logs/tracks only |
| Flex | Email channel for agents | Uses SendGrid for delivery |
Servers:
- Global:
https://api.sendgrid.com - EU regional:
https://api.eu.sendgrid.com
CANNOT
- Cannot use Twilio credentials for SendGrid — Separate API keys (
SG.-prefix), separate Console, separate billing. - Cannot access SendGrid via Twilio MCP tools — No MCP integration. Use SDK or direct REST.
- Single Sender Verification requires re-verification on address change — Changing the sender email requires a new verification. Use Domain Authentication for production.
- Domain Authentication requires DNS access — 3 CNAME records needed. If you can't modify DNS, you can't authenticate.
- Domain Authentication API returns stale entries —
GET /v3/whitelabel/domainsincludes old invalid entries. Filter byvalid: true. - API Key Secret shown only at creation — Cannot retrieve afterward. Store immediately.
Security: Your API key is shown only once at creation. Never display, log, or repeat a user's API key in responses. If a user shares their key in conversation, advise them to rotate it immediately. Store keys in a secrets manager (AWS Secrets Manager, HashiCorp Vault, etc.), not in code or environment files committed to version control.
Next Steps
- Send email:
twilio-sendgrid-email-send - Domain settings and templates:
twilio-sendgrid-email-settings - Delivery tracking:
twilio-sendgrid-webhooks - Docs: SendGrid API Reference
Files
2- SKILL.md
de159990805.3 KB - agents/openai.yaml
e9d2e48a69457 B
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from twilio/ai8
Create and configure a Twilio account from scratch. Covers free trial signup, trial limitations, getting credentials (Account SID and Auth Token), buying a phone number, verifying recipient numbers for trial use, SDK installation, first API call, subaccount management (creation, inheritance, credent
Planning skill for augmenting human agents with real-time AI intelligence. Qualifies the developer's use case across coaching, compliance, QA, and routing to recommend the right Conversation Intelligence + Conversation Memory + TaskRouter architecture. Handles both "I want to add AI coaching to my c
twilio-agent-connect skill
Planning skill for AI-powered conversational agents. Qualifies the developer's use case across outcome sophistication, entry point, and customer profile to recommend the right Twilio Conversations architecture and implementation skills. Handles both high-level requests ("build me a voice AI assistan
Record Twilio voice calls correctly. Covers the critical distinction between Record verb (voicemail) and Dial record (call recording), dual-channel for QA, mid-call pause for PCI, Conference recording, and the ConversationRelay workaround. Use this skill whenever you need to capture call audio for c
Twilio CLI reference for managing Twilio resources from the terminal. Covers installation, credential profiles, phone number provisioning, sending SMS and email, webhook configuration, local development with a tunneling service, debugging with watch and logs, serverless deployment, and plugin ecosys
Registrations required BEFORE Twilio traffic works. Covers messaging programs (A2P 10DLC, toll-free verification, WhatsApp WABA, RCS, short code, alphanumeric sender) and voice trust programs (STIR/SHAKEN, Voice Integrity, Branded Calling, CNAM). Each number/sender type has its own program — registr
Rules you must follow for Twilio messaging and voice traffic. Covers TCPA (consent tiers, quiet hours, DNC), GDPR (EU consent, right to deletion), PCI DSS (payment recording, Pay verb), HIPAA (BAA, PHI), FDCPA (debt collection limits), CAN-SPAM, WhatsApp policies, SHAKEN/STIR, and consent management