Send Slack Notifications on License Revocations
Clifford2 min read
slackwebhooksnotificationsrevocationkeymint
When a license is blocked — whether from the dashboard, via API, or because a Stripe subscription expired — your support team should know immediately. Here's how to push Keymint's license.disabled and floating_session.revoked events to Slack.
How It Works
- A license gets blocked (dashboard, API, or automated Stripe handler)
- Keymint emits
license.disabledoutbound webhook - Your handler verifies the HMAC-SHA256 signature
- Your handler posts a formatted message to Slack via incoming webhook
Setup
Slack: Create a Slack App at api.slack.com → Incoming Webhooks → add to your workspace. Copy the webhook URL.
Keymint: Dashboard → Developer → Webhooks → Create Endpoint. Subscribe to license.disabled, license.enabled, floating_session.revoked. Save the signing secret.
The Handler
Verify the signature (same HMAC-SHA256 pattern from the Discord recipe), then post:
typescript
const event = JSON.parse(payload);
const labels = {
'license.disabled': '🔴 License Blocked',
'license.enabled': '🟢 License Re-enabled',
'floating_session.revoked': '🔴 Floating Session Revoked',
};
if (labels[event.type]) {
await fetch(process.env.SLACK_WEBHOOK_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
text: labels[event.type],
blocks: [
{ type: 'header', text: { type: 'plain_text', text: labels[event.type] } },
{
type: 'section',
fields: [
{ type: 'mrkdwn', text: `*Product:*\n${event.data.license?.productId}` },
{ type: 'mrkdwn', text: `*Customer:*\n${event.data.license?.customerEmail || 'N/A'}` },
{ type: 'mrkdwn', text: `*License Type:*\n${event.data.license?.licenseType || 'N/A'}` },
{ type: 'mrkdwn', text: `*Activations:*\n${event.data.license?.activations || 0}/${event.data.license?.maxActivations || '∞'}` },
],
},
{ type: 'context', elements: [{ type: 'mrkdwn', text: `${event.created_at}` }] },
],
}),
});
}Test
bash
curl -X POST https://api.keymint.dev/key/block \
-H "Authorization: Bearer YOUR_ADMIN_API_KEY" \
-d '{"productId":"prod_xxx","licenseKey":"KM-XXXX-XXXX-XXXX"}'Going Further
- Add a "View in Dashboard" button linking to
app.keymint.dev - Mention the support team with
<!subteam^TEAM_ID>for high-priority revocations - Filter by product ID to only notify on specific products
Keymint emits 21 event types via outbound webhooks. Full catalog: keymint.dev/docs/topics/webhooks