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

twilio-email-send — Codex skill: what it does, how to install

Sends single and batch emails through native Twilio Email endpoints using Liquid templates. Built for projects using standard Twilio credentials instead of SendGrid.

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

What twilio-email-send does

This skill connects your coding agent to the native Twilio Email API at https://comms.twilio.com/v1/Emails. It handles single messages as well as batches up to 10,000 recipients in a single request. Content templating relies on Liquid variables.

All dispatches run asynchronously. The API returns a 202 Accepted status with an operationLocation link, which the agent polls to monitor delivery. The skill strictly enforces user confirmation before transmitting any message.

Authentication requires Twilio Account SID and Auth Token or API Key credentials. SendGrid API keys with the SG. prefix will fail here because Twilio Email is a separate service. Senders must verify their domain identity in the Twilio console, and message payloads cannot exceed 10MB.

What it helps with

  • send batch messages to up to 10,000 recipients in a single call
  • personalize subject lines and HTML bodies with Liquid tags
  • poll operationLocation to monitor asynchronous delivery status
  • dispatch emails using core Twilio credentials without SendGrid

Example prompts for the agent

  • Send an order confirmation email to [email protected] from [email protected] using Twilio Email
  • Run a batch send to 50 recipients with custom Liquid variables for each user
  • Query operationLocation to get the delivery status of the recent email batch

How to install twilio-email-send

1Skills CLI (Vercel)

npx skills add openai/plugins --skill twilio-email-send -a codex

2Manually: put the files in place

.agents/skills/twilio-email-send/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-email-send

How to install twilio-email-send in Codex?

Run npx skills add openai/plugins --skill twilio-email-send -a codex. Codex adds the skill to .agents/skills/twilio-email-send/SKILL.md.

How does Twilio Email differ from SendGrid?

Twilio Email uses standard Twilio credentials, Liquid syntax, and a 10MB payload ceiling. SendGrid requires SG. keys, uses Handlebars, and supports 30MB messages.

What prerequisites are required before sending?

You need active Twilio credentials and a Verified Sender domain configured in the Twilio console. The address domain in the from field must match that identity.

Source text

SKILL.md · MIT
---
name: twilio-email-send
description: >
  Use when the caller has Twilio credentials (Account SID + Auth Token or
  API Key SID + Secret) and needs to send email via comms.twilio.com/v1/Emails.
  This is Twilio-native email — NOT SendGrid. Do NOT use if the caller has a
  SendGrid API key (SG.-prefix) — use twilio-sendgrid-email-send instead.
  Covers single sends, batch sends up to 10,000 recipients, Liquid
  personalization, operation tracking, and error handling.
---

## Overview

> **Agent safety:** Always confirm recipients, subject, and content with the user before sending. Email is irreversible once delivered. Never send email autonomously without explicit user approval — especially for batch sends to multiple recipients.

**Twilio Email is a separate product from SendGrid.** Both send email, but they use different APIs, credentials, templating languages, and endpoints. If you have a SendGrid API key (`SG.`-prefix), use `twilio-sendgrid-email-send` instead.

| | Twilio Email (this skill) | SendGrid |
|---|---|---|
| **Base URL** | `https://comms.twilio.com/v1/emails` | `https://api.sendgrid.com/v3/mail/send` |
| **Auth** | Twilio Account SID + Auth Token (or API Key SID + Secret) | SendGrid API key (`SG.`-prefix) |
| **Templating** | Liquid (`{{variable}}`) | Handlebars (`{{variable}}`) |
| **Max recipients/request** | 10,000 | 1,000 |
| **Max message size** | 10MB (including attachments) | 30MB |
| **Status tracking** | Operation resource (poll `operationLocation`) | Event Webhooks (async POST) |
| **Console** | console.twilio.com | app.sendgrid.com |

---

## Prerequisites

- A Twilio account — see `twilio-account-setup` for signup and credentials
- A **Verified Sender**: an approved domain identity configured in the Twilio console that must match the `from` address domain
- Compliance with regional anti-spam regulations (CAN-SPAM, GDPR)

For a complete setup guide, see the Email Onboarding guide in the Twilio console.

---

## Authentication

The API uses **Basic Authentication** with either:
- Account SID + Auth Token
- API Key SID + API Key Secret

These are standard Twilio credentials — the same ones used for SMS, Voice, and other Twilio APIs.

---

## Send a Simple Email

`POST https://comms.twilio.com/v1/Emails`

The endpoint is **asynchronous** — it returns `202 Accepted` with an `operationId`, not a delivery confirmation.

```bash
curl -X POST "https://comms.twilio.com/v1/Emails" \
  --header "Content-Type: application/json" \
  --data '{
    "from": {
      "address": "[email protected]",
      "name": "Support Team"
    },
    "to": [
      {
        "address": "[email protected]",
        "name": "John Doe"
      }
    ],
    "content": {
      "subject": "Your subject line",
      "html": "<p>Your message content in HTML format.</p>",
      "text": "Your message content in plain text."
    }
  }' \
  -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

Response (`202 Accepted`):
```json
{
  "operationId": "...",
  "operationLocation": "https://comms.twilio.com/v1/Emails/Operations/..."
}
```

Poll `operationLocation` to track delivery status.

---

## Batch Sending

Send the same message to multiple recipients in a single request by adding entries to the `to` array. Maximum **10,000 recipients** per request.

```json
{
  "from": {
    "address": "[email protected]",
    "name": "Support Team"
  },
  "to": [
    {
      "address": "[email protected]",
      "name": "John Doe"
    },
    {
      "address": "[email protected]",
      "name": "Jane Smith"
    }
  ],
  "content": {
    "subject": "Your subject line",
    "html": "<p>Your message content in HTML format.</p>",
    "text": "Your message content in plain text."
  }
}
```

---

## Liquid Personalization

Use Liquid templating in the `content.subject`, `content.html`, and `content.text` fields. For each variable referenced (e.g. `{{firstName}}`), provide a matching key in the `variables` object for every recipient in the `to` array.

```json
{
  "from": {
    "address": "[email protected]",
    "name": "Support Team"
  },
  "to": [
    {
      "address": "[email protected]",
      "name": "Alice",
      "variables": {"firstName": "Alice", "orderId": "123"}
    },
    {
      "address": "[email protected]",
      "name": "Bob",
      "variables": {"firstName": "Bob", "orderId": "456"}
    }
  ],
  "content": {
    "subject": "Hi {{firstName}}, your order update",
    "html": "<p>Hi {{firstName}}, order #{{orderId}} has shipped.</p>",
    "text": "Hi {{firstName}}, order #{{orderId}} has shipped."
  }
}
```

Ensure every recipient has all referenced variables defined.

---

## Operation Tracking

After submitting a send, use the Operation resource to monitor batch status.

1. Submit email via `POST /v1/emails` — response includes `operationId` and `operationLocation`
2. Poll status via `GET` to the `operationLocation` URI
3. The operation tracks progress for the entire batch

This is especially important for large recipient lists where processing is not instantaneous.

---

## Error Codes

| Status Code | Description | Action |
|-------------|-------------|--------|
| **202** | Accepted | Request accepted, Operation created. Poll `operationLocation` for status. |
| **400** | Bad Request | Malformed or ambiguous request content. Check JSON payload. |
| **401** | Unauthorized | Verify Account SID and Auth Token / API Key are correct. |
| **429** | Too Many Requests | Rate limited. Back off and retry. |
| **500** | Internal Server Error | Twilio server-side issue. Retry with backoff. |
| **503** | Service Unavailable | Temporarily unavailable. Retry after a short delay. |

Validation errors return as many issues as possible in a single response to help debug quickly.

---

## CANNOT

- **Cannot use SendGrid API keys** — Twilio Email uses Twilio Account SID + Auth Token or API Key SID + Secret. `SG.`-prefix keys do not work. Use `twilio-sendgrid-email-send` for SendGrid.
- **Cannot send more than 10,000 recipients per request** — Split into multiple requests for larger lists.
- **Cannot exceed 10MB per message** — Total size including attachments must be under 10MB (smaller than SendGrid's 30MB limit).
- **Cannot use Unicode in the `from` field** — Unicode encoding is not supported for sender addresses.
- **Cannot use Handlebars templating** — Twilio Email uses Liquid, not Handlebars. If you see `{{#if}}` or `{{#each}}`, that's Handlebars/SendGrid syntax.
- **Cannot get synchronous delivery confirmation** — The API is async. `202 Accepted` means queued, not delivered. Poll the Operation resource for status.
- **Tags total length cannot exceed 10,000 bytes** — Combined length of all tags on a request is limited.

---

## Next Steps

- **Account setup and credentials:** `twilio-account-setup`
- **SendGrid email (separate product):** `twilio-sendgrid-email-send`
- **SMS sending:** `twilio-sms-send-message`

© Twilio · MIT · openai/plugins

Similar skills

All skills for Backend and APIs →

From the same set596

The whole set →
twilio-lookup-phone-intelligence A Claude and Claude skill that validates phone numbers through Twilio Lookup v2 and scores fraud risk before you send an SMS or place a call. CX Codex GP ChatGPT ★ 7,604repo stars twilio-identity-verification-advisor Plans user identity verification, 2FA, and fraud defense architectures with Twilio Verify and Lookup. Guides channel choices and risk handling across signup and login flows. CX Codex GP ChatGPT ★ 7,604repo stars twilio-iam-auth-setup A Codex and ChatGPT skill that walks through Twilio credentials: Auth Token, API keys, and Access Tokens for client-side SDKs. Handy before the first Twilio API call. CX Codex GP ChatGPT ★ 7,604repo stars twilio-enterprise-knowledge This skill walks an agent through creating a Twilio Knowledge Base, loading your documents into it and pulling relevant chunks back at answer time. CX Codex GP ChatGPT ★ 7,604repo stars twilio-email-deliverability-advisor This skill diagnoses delivery issues for the Twilio Email API and suggests checks to run. Use it when messages land in spam, bounce, or get blocked. CX Codex GP ChatGPT ★ 7,604repo stars twilio-debugging-observability Walks through why messages fail to deliver and calls drop, then sets up Twilio monitoring for production. CX Codex GP ChatGPT ★ 7,604repo stars twilio-customer-support-architect Architects customer support setups on Twilio. It evaluates channel mix, call volume, and automation needs to recommend the right stack from TwiML to Flex. CX Codex GP ChatGPT ★ 7,604repo stars twilio-customer-memory Connects Codex projects to Twilio Conversation Memory for persistent customer context. Use it when an agent must carry customer details across sessions and channels. 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