twilio-sendgrid-inbound-parse — скилл для Codex: приём входящей почты
Скилл учит агента принимать входящие письма через SendGrid Inbound Parse: MX-записи, разбор полей, вложения и подводные камни.
npx skills add openai/plugins --skill twilio-sendgrid-inbound-parse -a codexЧто делает twilio-sendgrid-inbound-parse
Inbound Parse превращает входящее письмо в HTTP POST на ваш вебхук. SendGrid принимает почту на MX-записях домена и пересылает разобранное содержимое приложению. Скилл описывает всю цепочку: куда направить MX, как добавить хост и URL в консоли SendGrid, чем parsed-режим отличается от raw.
В parsed-режиме приходят готовые поля формы: from, to, subject, text, html, envelope, число вложений и сами файлы attachment1, attachment2. Внутри есть пример обработчика на Flask, который читает эти поля и перебирает вложения. Raw-режим кладёт всё письмо целиком в rawEmail — пригодится, если нужны полные заголовки или подписи DKIM, но MIME придётся разбирать самому.
Для работы нужен ключ SendGrid с префиксом SG., и он не подойдёт для Twilio Email API на comms.twilio.com. MX-записи придётся менять, а на домене, который уже принимает почту, Inbound Parse не заработает — скилл советует взять поддомен вроде inbound.yourdomain.com, чтобы не сломать Google Workspace или Microsoft 365. Письма крупнее 30MB отклоняются, порядок доставки не гарантирован, а фильтровать почту до вебхука нельзя: всё, что пришло на домен, дойдёт до вашего обработчика. Содержимое письма — недоверенный ввод, поэтому HTML санитизируйте, а текст для LLM держите отдельно от системного промпта.
Какие задачи решает
- принимать письма на своём домене и превращать их в HTTP-запросы
- создавать тикеты в поддержке из входящей почты
- разбирать вложения из письма и сохранять их
- настроить MX-записи так, чтобы не сломать существующую почту
- проверять подлинность вебхука подписью вместо списка IP
Примеры запросов агенту
- Настрой Inbound Parse для поддомена inbound.example.com и напиши обработчик на Flask
- Покажи, как в parsed-режиме достать вложения из письма
- Почему мой вебхук не получает письма после смены MX-записей?
Как установить twilio-sendgrid-inbound-parse
1Через Skills CLI (Vercel)
npx skills add openai/plugins --skill twilio-sendgrid-inbound-parse -a codex2Вручную: положить файлы
.agents/skills/twilio-sendgrid-inbound-parse/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add openai/plugins --skill twilio-sendgrid-inbound-parse -a claude-code2Вручную: положить файлы
~/.claude/skills/twilio-sendgrid-inbound-parse/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/twilio-sendgrid-inbound-parse/
Вручную: положить файлы
.cursor/skills/twilio-sendgrid-inbound-parse/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install openai/plugins twilio-sendgrid-inbound-parse2Вручную: положить файлы
.github/skills/twilio-sendgrid-inbound-parse/SKILL.mdКомандой платформы
gemini skills install https://github.com/openai/plugins --path plugins/twilio-developer-kit/skills/twilio-sendgrid-inbound-parseВручную: положить файлы
.devin/skills/twilio-sendgrid-inbound-parse/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Claude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Скиллы Codex: как установить, где лежат и как вызвать
Из того же набора304
Весь набор →Похожие
Вопросы о twilio-sendgrid-inbound-parse
Как установить twilio-sendgrid-inbound-parse в Claude?
Выполните npx skills add openai/plugins --skill twilio-sendgrid-inbound-parse -a codex. После этого скилл лежит в .agents/skills/twilio-sendgrid-inbound-parse/SKILL.md.
Что делает twilio-sendgrid-inbound-parse?
Описывает приём входящей почты через SendGrid Inbound Parse: настройку MX-записей, добавление вебхука, разницу parsed и raw, работу с вложениями и типичные ошибки.
Чем parsed-режим отличается от raw?
В parsed-режиме SendGrid сам разбирает письмо и присылает поля формы с текстом, HTML и вложениями. Raw отдаёт всё сообщение в поле rawEmail, и MIME вы разбираете сами.
Исходный текст
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