plugins/twilio-developer-kit/skills/twilio-sendgrid-inbound-parse/SKILL.md
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).
npx skillsauth add openai/plugins twilio-sendgrid-inbound-parseInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
mx.sendgrid.netSubdomain recommended: Use inbound.yourdomain.com to avoid disrupting existing email on yourdomain.com.
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)
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).
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.
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.
mx.sendgrid.net. Use a subdomain to avoid disrupting existing email (e.g., Google Workspace, Microsoft 365).twilio-sendgrid-email-sendtwilio-sendgrid-webhookstwilio-sendgrid-account-setupdevelopment
Use when the user wants to spin up / create / launch / provision a DigitalOcean droplet (or "a remote dev box on DO") and connect to it from Codex as a remote SSH workspace.
data-ai
Search through Microsoft Teams chats or channels, triage unread or recent activity, draft follow-ups, and manage Planner tasks through connected Teams data.
tools
Motion / animation context for the `use_figma` MCP tool — animating Figma nodes via manual keyframes, animation styles, easing, and timeline duration. Load alongside figma-use whenever a task involves adding, editing, or inspecting animation on a node.
development
SwiftUI ↔ Figma translation. Use whenever the user mentions Swift, SwiftUI, iOS, iPhone, or iPad — in EITHER direction — translating a Figma design into SwiftUI (design → code), or pushing SwiftUI views / screens / tokens back into a Figma file (code → design). Triggers on phrases like 'implement this Figma design in SwiftUI', 'build this screen in Swift', 'push this SwiftUI view to Figma', 'mirror my Swift code in a Figma file', or whenever a Figma URL appears alongside `.swift` files / an `.xcodeproj`. Routes to a direction-specific reference doc; loads alongside `figma-use` for the code → design path.