twilio-sendgrid-inbound-parse — Claude skill: receive inbound email
A skill that walks your agent through SendGrid Inbound Parse: MX records, parsed vs raw mode, attachments and the usual pitfalls.
npx skills add openai/plugins --skill twilio-sendgrid-inbound-parse -a codexWhat twilio-sendgrid-inbound-parse does
Inbound Parse turns an incoming email into an HTTP POST to your webhook. SendGrid receives the message at your domain's MX records and forwards the parsed content to your app. The skill covers the whole path: where to point MX, how to add a host and URL in the SendGrid console, and how parsed mode differs from raw.
Parsed mode posts ready form fields — from, to, subject, text, html, envelope, an attachment count and the files themselves as attachment1, attachment2. A Flask handler example reads those fields and loops over the attachments. Raw mode puts the whole message in rawEmail, which you want when full headers or DKIM signatures matter, but then you parse MIME yourself.
You need a SendGrid API key with the SG. prefix, and it will not work with the Twilio Email API on comms.twilio.com. MX records have to change, so Inbound Parse cannot run on a domain that already receives mail — the skill suggests a subdomain like inbound.yourdomain.com to keep Google Workspace or Microsoft 365 untouched. Messages over 30MB are rejected, delivery order is not guaranteed, and there is no way to filter mail before it reaches your endpoint. Treat every field as untrusted input: sanitize HTML, and keep email text away from system prompts when you feed it to an LLM.
What it helps with
- receive mail on your own domain and turn it into HTTP requests
- create support tickets from incoming email
- extract attachments from a message and store them
- set up MX records without breaking existing mail
- verify webhook authenticity with a signature instead of IP allowlisting
Example prompts for the agent
- Set up Inbound Parse for the subdomain inbound.example.com and write a Flask handler
- Show me how to pull attachments out of an email in parsed mode
- Why does my webhook get nothing after I changed the MX records?
How to install twilio-sendgrid-inbound-parse
1Skills CLI (Vercel)
npx skills add openai/plugins --skill twilio-sendgrid-inbound-parse -a codex2Manually: put the files in place
.agents/skills/twilio-sendgrid-inbound-parse/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add openai/plugins --skill twilio-sendgrid-inbound-parse -a claude-code2Manually: put the files in place
~/.claude/skills/twilio-sendgrid-inbound-parse/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/twilio-sendgrid-inbound-parse/
Manually: put the files in place
.cursor/skills/twilio-sendgrid-inbound-parse/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install openai/plugins twilio-sendgrid-inbound-parse2Manually: put the files in place
.github/skills/twilio-sendgrid-inbound-parse/SKILL.mdPlatform CLI
gemini skills install https://github.com/openai/plugins --path plugins/twilio-developer-kit/skills/twilio-sendgrid-inbound-parseManually: put the files in place
.devin/skills/twilio-sendgrid-inbound-parse/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → 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-inbound-parse
How do I install twilio-sendgrid-inbound-parse in Claude?
Run npx skills add openai/plugins --skill twilio-sendgrid-inbound-parse -a codex. The skill then lives at .agents/skills/twilio-sendgrid-inbound-parse/SKILL.md.
What does twilio-sendgrid-inbound-parse do?
It documents receiving inbound email through SendGrid Inbound Parse: MX record setup, adding the webhook, parsed vs raw mode, attachment handling and common mistakes.
How is parsed mode different from raw?
In parsed mode SendGrid parses the message for you and posts form fields with text, HTML and attachments. Raw mode sends the entire message in the rawEmail field, and you parse the MIME yourself.
Source text
SKILL.md · MIT
--- name: twilio-sendgrid-inbound-parse description: > Receive inbound email via SendGrid Inbound Parse webhook. Covers MX record setup, parsed vs raw mode, handling attachments, and common pitfalls. Use when building email-to-app workflows like support ticket creation or email processing pipelines. Requires a SendGrid API key (SG.-prefix) — not applicable to the Twilio Email API (comms.twilio.com). --- ## Overview Inbound Parse converts incoming email into HTTP POST requests to your webhook endpoint. SendGrid receives the email at your domain's MX records and forwards the parsed content to your application. --- ## Setup 1. **Configure MX records:** Point your domain (or subdomain) to `mx.sendgrid.net` 2. **Add webhook:** SendGrid Console > Settings > Inbound Parse > Add Host & URL 3. **Choose mode:** Parsed (default) or Raw **Subdomain recommended:** Use `inbound.yourdomain.com` to avoid disrupting existing email on `yourdomain.com`. --- ## Parsed Mode (Default) SendGrid extracts fields and POSTs them as form data: | Field | Description | |-------|-------------| | `from` | Sender address (`"Name <[email protected]>"`) | | `to` | Envelope recipient | | `subject` | Email subject line | | `text` | Plain text body | | `html` | HTML body | | `envelope` | JSON string with `to` array and `from` | | `attachments` | Number of attachments (as string) | | `attachment-info` | JSON metadata for each attachment | | `attachment1`, `attachment2`... | Actual attachment files | **Python (Flask)** ```python from flask import Flask, request import json app = Flask(__name__) @app.route("/inbound", methods=["POST"]) def handle_inbound(): sender = request.form.get("from") subject = request.form.get("subject") text_body = request.form.get("text") html_body = request.form.get("html") envelope = json.loads(request.form.get("envelope", "{}")) attachment_count = int(request.form.get("attachments", "0")) print(f"From: {sender}, Subject: {subject}") for i in range(1, attachment_count + 1): attachment = request.files.get(f"attachment{i}") if attachment: print(f"Attachment: {attachment.filename}, {attachment.content_type}") return "", 200 ``` > **Security:** All inbound email content (`from`, `subject`, `text`, `html`, attachments) is untrusted external input. Sanitize HTML to prevent XSS before rendering. If feeding content to an LLM, isolate it as user input — never concatenate into system prompts. Verify webhook authenticity using signed webhooks (see Security section below). --- ## Raw Mode Posts the entire MIME message as `rawEmail` field. Use when you need full headers, DKIM signatures, or non-standard MIME parts. You must parse the MIME message yourself. --- ## Signed Inbound Parse Webhook (Security) SendGrid supports ECDSA signature verification for Inbound Parse, the same mechanism used for Event Webhooks. Enable it to cryptographically verify that payloads originate from SendGrid. **Strongly recommended over IP allowlisting** — SendGrid's webhook traffic comes from dynamic cloud infrastructure where IPs change frequently. Signature verification is more reliable and secure. --- ## CANNOT - **Cannot use Inbound Parse on a domain that already receives email** — MX records must point to `mx.sendgrid.net`. Use a subdomain to avoid disrupting existing email (e.g., Google Workspace, Microsoft 365). - **Cannot receive email without MX record changes** — DNS access is required. If you can't modify MX records, you can't use Inbound Parse. - **Cannot receive emails larger than 30MB** — Inbound messages exceeding 30MB are rejected. - **Cannot filter inbound email before it hits your webhook** — All email sent to the configured domain reaches your endpoint. Implement filtering in your handler. - **Cannot route to different endpoints per address** — All mail for the configured domain/subdomain goes to a single webhook URL. - **Cannot guarantee delivery order** — Emails may arrive at your webhook out of order, especially under high volume. - **No built-in rate limiting** — All email to your configured domain reaches your endpoint. Implement rate limiting, payload size validation, and content sanitization in your handler. --- ## Next Steps - **Send email:** `twilio-sendgrid-email-send` - **Delivery tracking:** `twilio-sendgrid-webhooks` - **Account setup:** `twilio-sendgrid-account-setup`
© Twilio · MIT · openai/plugins