metabase-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and authenticate Metabase alert webhooks. Use when setting up a Metabase webhook endpoint, checking the HTTP Basic Authorization header, debugging…
от hookdeck★ 104 звезды на GitHubОб этом скилле
Metabase Webhooks
Metabase can send the results of a saved question to a webhook when an alert fires. The default request is
a POST with a JSON body. Webhooks are not signed: there is no signature header and no
timestamp. Instead you choose an authentication method on the webhook, and this skill covers
HTTP Basic, where Metabase sends Authorization: Basic base64(username:password) on every
request, up front, and your endpoint compares it with the credentials you chose.
When to Use This Skill
- How do I receive Metabase webhooks (alert webhooks)?
- How do I check the Basic
Authorizationheader from Metabase? - Does Metabase sign webhook payloads? (No: use Basic authentication)
- How do I handle the
alertpayload,raw_dataand the base64 PNGvisualization? - Why does my Metabase webhook endpoint return 401?
Setup note
Choose Basic authentication on the Metabase webhook. (Bearer, API key and query-param options
are not covered here.) Use the same username and password in METABASE_WEBHOOK_USERNAME and
METABASE_WEBHOOK_PASSWORD. The examples accept POST. To receive the alert JSON with a PUT channel, enable PUT on the Hookdeck source and add a PUT route to your receiver. Hookdeck delivers GET without a body. Keep POST enabled for the admin form’s Send a test button.
Verification (core)
const crypto = require('crypto');
const sha = (b) => crypto.createHash('sha256').update(b).digest();
const safeEqual = (a, b) => crypto.timingSafeEqual(sha(a), sha(b)); // equal-length digests
function verifyMetabaseRequest(headers, username, password) {
if (!username || !password) return false; // never accept when unconfigured
const m = /^basic +([A-Za-z0-9+/]+={0,2})$/i.exec((headers['authorization'] || '').trim());
if (!m) return false; // strict base64 alphabet only
const decoded = Buffer.from(m[1], 'base64');
if (decoded.toString('base64') !== m[1]) return false; // reject trailing junk
const i = decoded.indexOf(0x3a); // split on the FIRST colon
if (i === -1) return false;
const userOk = safeEqual(decoded.subarray(0, i), Buffer.from(username));
const passOk = safeEqual(decoded.subarray(i + 1), Buffer.from(password));
return userOk && passOk; // evaluate both, no short-circuit
}
- Header:
Authorization: Basic base64(username:password); the scheme is case-insensitive. - Return
401for a missing or malformed header or a mismatch,400for a body that isn't a JSON object,200once handled. An authenticated request with an empty body is the webhook form's Send a test button: return200, or the test shows as failed. Credentials arrive on the first request (Metabase sends them preemptively), so there is no challenge round-trip to support. - Read the body raw (
express.raw({ type: '*/*', limit: '10mb' })) and authenticate before parsing it. Alerts embed a base64 PNG, so raise Express's default 100kb body limit. - In Python,
base64.b64decode(value, validate=True)andhmac.compare_digeston bytes (encode both sides;strwith non-ASCII raises). - A static shared credential authenticates the sender, not the body, and gives no replay protection (no signature, no timestamp). Use HTTPS, and rotate the credential if it leaks.
For complete handlers with tests, see examples/express/, examples/nextjs/, examples/fastapi/.
Payload and Event Types
There is one payload type, alert, and it's the type field of the body:
type |
Sent When |
|---|---|
alert |
A Metabase alert on a question fires (or an admin sends a test alert; then alert_id is null) |
{
"type": "alert",
"alert_id": null,
"alert_creator_id": 2666,
"alert_creator_name": "Roberto Bolaño",
"data": {
"type": "question",
"question_id": 108,
"question_name": "Sales",
"question_url": "https://example.com/question/108",
"visualization": "data:image/png;base64,...",
"raw_data": { "cols": ["CREATED_AT", "count"], "rows": "2024-09-01T00:00:00Z", 346 }
},
"sent_at": "2024-09-30T20:16:15.76582Z"
}
Environment Variables
METABASE_WEBHOOK_USERNAME=your-webhook-username # Admin > Settings > Webhooks > Basic
METABASE_WEBHOOK_PASSWORD=your-webhook-password
Local Development
Metabase can't reach localhost. Tunnel with the Hookdeck CLI (no account required):
npx hookdeck-cli listen 3000 metabase --path /webhooks/metabase
Use the printed URL as the webhook URL in Metabase. The webhook form's Send a test button posts with no body; for a full payload, create an alert on a question that returns results and click Send now.
Resources
- references/overview.md - What Metabase webhooks are, the alert payload
- [re
Установить metabase-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл metabase-webhooks?
Receive and authenticate Metabase alert webhooks. Use when setting up a Metabase webhook endpoint, checking the HTTP Basic Authorization header, debugging 401s, or handling alert payloads with question results (alert_id, question_url, raw_data, base64 PNG visualization).
Как установить скилл metabase-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл metabase-webhooks запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic