Skip to main content
skill CX Codex GP ChatGPT official · OpenAI

twilio-sendgrid-account-setup — Codex skill: setup guide

Prepares SendGrid for email delivery with API keys, sender checks, domain authentication, and SDK setup. Use it before other SendGrid skills.

Install into Codex · Skills CLI (Vercel) All methods and platforms ↓
npx skills add openai/plugins --skill twilio-sendgrid-account-setup -a codex
Open on GitHub

What twilio-sendgrid-account-setup does

This skill walks through SendGrid setup as a separate Twilio email service. It covers creating an API key with the SG. prefix, exposing it as SENDGRID_API_KEY, choosing access scopes, and installing the SDK for Python, Node.js, Java, C#, Ruby, PHP, or Go.

It separates test sender verification from production domain setup. The guide covers three CNAME records, DKIM, SPF, DMARC, SMTP settings, and the difference between SendGrid keys and Twilio credentials. It also points to SDK and REST API usage. Domain authentication cannot be completed without DNS access. The API secret appears only when the key is created, so store it in a secrets manager at once.

What it helps with

  • create a SendGrid API key with limited permissions
  • set up SENDGRID_API_KEY for an application
  • install the SendGrid SDK for a chosen language
  • verify a sender for test email delivery
  • configure DKIM, SPF, and DMARC for a domain

Example prompts for the agent

  • Set up SendGrid for this project and tell me which API key permissions the app needs.
  • List the DNS records required for SendGrid domain authentication and put the setup steps in order.
  • Prepare SendGrid for a Python app, install sendgrid, and show how to store the key safely.

How to install twilio-sendgrid-account-setup

1Skills CLI (Vercel)

npx skills add openai/plugins --skill twilio-sendgrid-account-setup -a codex

2Manually: put the files in place

.agents/skills/twilio-sendgrid-account-setup/SKILL.md

For all projects use ~/.agents/skills/

Step by step, with commands for each platform: Codex skills: how to install, where they live, how to call them

Questions about twilio-sendgrid-account-setup

How do I install twilio-sendgrid-account-setup in Codex?

Run npx skills add openai/plugins --skill twilio-sendgrid-account-setup -a codex, then check .agents/skills/twilio-sendgrid-account-setup/SKILL.md.

What does twilio-sendgrid-account-setup do?

It guides SendGrid email setup, including API keys, permission scopes, SDK installation, sender verification, and domain authentication. It also explains why SendGrid keys cannot be replaced with Twilio credentials.

What is required for SendGrid domain authentication?

You need DNS access because the setup uses three CNAME records for DKIM and the return path. Single Sender Verification is intended for testing, not production.

Source text

SKILL.md · MIT
---
name: twilio-sendgrid-account-setup
description: >
  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 skill is for SendGrid only — not the Twilio Email API (comms.twilio.com).
---

## 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

1. Get your API key from [SendGrid Console > Settings > API Keys](https://app.sendgrid.com/settings/api_keys)
2. Set environment variable:

```bash
export SENDGRID_API_KEY=SG.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

3. 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` |

4. 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:
1. `s1._domainkey.yourdomain.com` → `s1.domainkey.u1234.wl.sendgrid.net` (DKIM)
2. `s2._domainkey.yourdomain.com` → `s2.domainkey.u1234.wl.sendgrid.net` (DKIM)
3. `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/domains` includes old invalid entries. Filter by `valid: 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](https://www.twilio.com/docs/sendgrid/api-reference)

© Twilio · MIT · openai/plugins

Similar skills

All skills for Backend and APIs →

From the same set528

The whole set →
twilio-sendgrid-suppressions This skill helps investigate SendGrid suppressions and manage category-based unsubscribes. Use it when diagnosing delivery problems or building unsubscribe flows. CX Codex GP ChatGPT ★ 7,604repo stars twilio-sendgrid-inbound-parse A skill that walks your agent through SendGrid Inbound Parse: MX records, parsed vs raw mode, attachments and the usual pitfalls. CX Codex GP ChatGPT ★ 7,604repo stars twilio-sendgrid-email-settings Configure SendGrid templates, email tracking, and branded links with this skill. Use it when changing message content or delivery settings. CX Codex GP ChatGPT ★ 7,604repo stars twilio-sendgrid-email-send A skill that shows the agent how to send mail through the SendGrid v3 Mail Send API: single sends, batch sends with templates, scheduled sends and attachments. Requires an SG-prefixed API key. CX Codex GP ChatGPT ★ 7,604repo stars twilio-security-compliance-hipaa This skill walks through preparing Twilio for HIPAA workflows, from BAA and project designation to product-specific limits. Use it when building healthcare features that handle PHI. CX Codex GP ChatGPT ★ 7,604repo stars twilio-security-api-auth Walks you through Twilio's four auth methods and helps you wire up the right one before shipping API calls to production. CX Codex GP ChatGPT ★ 7,604repo stars twilio-regulatory-compliance-bundles Prepare Twilio Regulatory Bundles for international numbers, from checking country rules to submitting a bundle for review. CX Codex GP ChatGPT ★ 7,604repo stars twilio-rcs-messaging A Claude and Claude skill that walks you from RCS sender onboarding to sending rich cards and carousels through Twilio. CX Codex GP ChatGPT ★ 7,604repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor