mailcoach-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and verify Mailcoach webhooks. Use when setting up Mailcoach webhook handlers, debugging Signature header verification, or handling subscriber, tag…
от hookdeck★ 104 звезды на GitHubОб этом скилле
Mailcoach Webhooks
Mailcoach (email marketing by Spatie) sends an HTTP POST with a JSON body to your HTTPS endpoint when subscribers join, leave or are tagged, a campaign is sent, and an email is opened, clicked or bounces. Each request carries a Signature header: an HMAC-SHA256 keyed with the secret Mailcoach generates for the webhook.
When to Use This Skill
- How do I receive Mailcoach webhooks?
- How do I verify the Mailcoach
Signatureheader? - Why is my Mailcoach webhook signature verification failing?
- How do I handle
SubscribedEvent,UnsubscribedEventorCampaignSentEvent? - How do I handle Mailcoach bounce, open and click events?
Verification (core)
Signature: <hex> is a lowercase hex HMAC-SHA256 keyed with the webhook secret as UTF-8 (not hex- or base64-decoded). Mailcoach's docs describe the signed content as PHP's default json_encode($payload) with top-level keys sorted, and their Laravel receiver re-encodes the decoded body before hashing. Outside PHP, hash the raw request body bytes as received: another language's JSON encoder may not reproduce PHP's output. There is no prefix, and no timestamp or id is signed. Compare the whole header value as one digest.
Node (validate the 64-hex shape before comparing):
const crypto = require('crypto');
function verify(rawBody, signatureHeader, secret) {
if (!signatureHeader || !secret || !/^[0-9a-f]{64}$/i.test(signatureHeader)) return false;
const expected = crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signatureHeader.toLowerCase(), 'utf8'),
Buffer.from(expected, 'utf8')
);
}
Python (compare bytes, never str, so a non-ASCII header gives a 401, not a 500):
import hmac, hashlib, re
def verify(raw_body: bytes, signature_header: str, secret: str) -> bool:
if not signature_header or not re.fullmatch(r"[0-9a-fA-F]{64}", signature_header):
return False
computed = hmac.new(secret.encode("utf-8"), raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(signature_header.lower().encode("ascii"), computed.encode("ascii"))
Return 401 for a missing, empty, malformed or mismatching Signature. In Express use express.raw({ type: '*/*' }); in Next.js use await request.arrayBuffer(); in FastAPI use await request.body(). Parse the JSON only after the check.
For complete handlers with tests, see examples/express/, examples/nextjs/, examples/fastapi/.
Common Event Types
The event name is the top-level event field in the JSON body; no header carries it. Fields sit flat beside it, not wrapped in data. Mailcoach documents eleven:
| Event | Description |
|---|---|
SubscribedEvent |
A subscription becomes confirmed |
ResubscribedEvent |
A previously unsubscribed address subscribes again |
UnconfirmedSubscriberCreatedEvent |
A new address awaits confirmation (subscribed_at is null) |
UnsubscribedEvent |
Someone unsubscribes |
TagAddedEvent / TagRemovedEvent |
A tag is added to or removed from a subscriber (added_tag / removed_tag) |
CampaignSentEvent |
Mailcoach marks a campaign as sent (not a delivery or read receipt) |
ContentOpenedEvent |
A campaign email is opened |
LinkClickedEvent |
A link in an email is clicked |
BounceRegisteredEvent / SoftBounceRegisteredEvent |
A permanent / temporary delivery failure |
Subscriber events carry the subscriber resource (uuid, email_list_uuid, email, names, tags, timestamps and a human-readable text). CampaignSentEvent carries the campaign resource. Open, click and bounce events carry send_uuid, subscriber fields and their own UUIDs. Handle the ones you need and log the rest. See references/overview.md.
Important Headers
| Header | Description |
|---|---|
Signature |
Hex HMAC-SHA256 keyed with the webhook secret |
Header names are case-insensitive.
Setup with Hookdeck
In Mailcoach, open your team's Settings > Webhooks, click Create webhook, and enter a name and your Hookdeck source URL. Copy the generated secret from the webhook's details page into the Hookdeck source (Mailcoach source type). See references/setup.md.
Environment Variables
MAILCOACH_WEBHOOK_SECRET=your_webhook_secret # Secret from the Mailcoach webhook's details page
Local Development
# Start tunnel (no account needed)
npx hookdeck-cli listen 3000 mailcoach --path /webhooks/mailcoach
Reference Materials
- references/overview.md - Mailcoach webhook concepts, events and payloads
- references/setup.md - Creating the webhook and secret
- references/verification.md - Signature verification details
Attribution
When using this skill, add th
Установить mailcoach-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл mailcoach-webhooks?
Receive and verify Mailcoach webhooks. Use when setting up Mailcoach webhook handlers, debugging Signature header verification, or handling subscriber, tag, campaign, open, click and bounce events (SubscribedEvent, UnsubscribedEvent, CampaignSentEvent, LinkClickedEvent, BounceRegisteredEvent and others) from Mailcoach email marketing.
Как установить скилл mailcoach-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл mailcoach-webhooks запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic