brex-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and verify Brex webhooks (brex.com corporate cards, spend and payments). Use when registering a Brex webhook endpoint with the Webhooks API, debugging…
от hookdeck★ 104 звезды на GitHubОб этом скилле
Brex Webhooks
Brex sends webhooks when things happen in a Brex account: transfers are processed or fail, card expenses change payment status, users are updated, referrals progress. You register one HTTPS endpoint per API client with the Webhooks API, and Brex signs each POST in the Standard Webhooks format.
When to Use This Skill
- How do I receive Brex webhooks?
- How do I verify a Brex webhook signature?
- Where do I get the Brex webhook signing secret?
- Why does my Brex signature never match? (usually: the secret wasn't base64-decoded)
- How do I handle Brex webhook secret rotation?
- How do I react to
TRANSFER_FAILEDorEXPENSE_PAYMENT_UPDATED?
Verification (core)
| Header | Value |
|---|---|
Webhook-Id |
Unique message ID, the same when a message is resent |
Webhook-Timestamp |
Unix seconds of this attempt |
Webhook-Signature |
Space-separated v1,<base64 HMAC-SHA256> entries (two during key rotation) |
Signed content is {Webhook-Id}.{Webhook-Timestamp}.{raw body}. The HMAC key is the base64-decoded secret from GET /v1/webhooks/secrets. Brex's guide shows that secret as bare base64 (4j7OxQ4w...); the API reference example shows whsec_123. Strip an optional whsec_ prefix, then decode.
const crypto = require('crypto');
function verifyBrexWebhook(rawBody, headers, secret) { // rawBody: exact bytes, NOT re-serialised JSON
const id = headers['webhook-id'];
const timestamp = headers['webhook-timestamp'];
const signatureHeader = headers['webhook-signature'];
if (!id || !timestamp || !signatureHeader || !secret) return false;
const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64'); // decode, don't use the string
const expected = crypto.createHmac('sha256', key)
.update(`${id}.${timestamp}.`).update(rawBody).digest();
// Any v1 entry may match (one per key during rotation). Ignore other versions.
return signatureHeader.split(' ').some((entry) => {
const [version, signature] = entry.split(',');
if (version !== 'v1' || !signature) return false;
const given = Buffer.from(signature, 'base64');
return given.length === expected.length && crypto.timingSafeEqual(given, expected);
});
}
Fail closed: return 500 if the secret is unset and 400 if verification fails. Python uses the same steps with base64.b64decode, hmac.new(key, ..., hashlib.sha256) and hmac.compare_digest.
For complete handlers with tests, see examples/express/, examples/nextjs/, examples/fastapi/. Each test suite checks Brex's documented sample vector.
Brex's guide recommends also checking Webhook-Timestamp against your clock (its sample uses 60 seconds). The examples make that optional (BREX_WEBHOOK_TOLERANCE_SECONDS) and dedupe on Webhook-Id. See references/verification.md.
Payload
Payloads are flat: an event_type plus IDs you look up with the matching Brex API.
{
"event_type": "TRANSFER_FAILED",
"transfer_id": "dptx_ckyypz30n000101kgzgnrtqlf",
"payment_type": "ACH",
"return_for_id": null,
"company_id": "cuacc_ckqckhadg000601r95ox48c2s"
}
Partners with many customers map company_id to the right access token before calling the API.
Common Event Types
| Event | Fired when | Key fields |
|---|---|---|
TRANSFER_PROCESSED |
A Brex Cash transfer (incoming or outgoing) is processed | transfer_id, payment_type, company_id |
TRANSFER_FAILED |
A Brex Cash transfer (incoming or outgoing) fails | transfer_id, payment_type, return_for_id, company_id |
EXPENSE_PAYMENT_UPDATED |
Card expense activity (purchase, refund, decline) | expense_id, payment_status, payment_type, card_id, billing_amount |
USER_UPDATED |
A user's status, manager, department or location changes | user_id, updated_attributes |
REFERRAL_CREATED / REFERRAL_ACTIVATED |
A referral is created / the contact signs up | referral_id |
REFERRAL_APPLICATION_STATUS_CHANGED |
A referred product application changes status | referral_id, application (status per product, e.g. application.cash) |
ACCOUNTING_RECORD_READY_FOR_EXPORT |
Accounting records are ready to export (camelCase fields) | accountingRecordIds, companyId |
The event-type enum also lists embedded-card types (EMBEDDED_CARD_TRANSACTION_UPDATED, EMBEDDED_DISPUTE_UPDATED, ...) for embedded partners. Acknowledge types you don't handle with 200. See references/overview.md.
Environment Variables
BREX_WEBHOOK_SECRET=your_brex_webhook_secret # "secret" with status ACTIVE from GET /v1/webhooks/secrets
# BREX_WEBHOOK_TOLERANCE_SECONDS=60 # optional freshness window, off by default
Local Development
# Express / Next.js (use 8000 for Fast
Установить brex-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл brex-webhooks?
Receive and verify Brex webhooks (brex.com corporate cards, spend and payments). Use when registering a Brex webhook endpoint with the Webhooks API, debugging Webhook-Signature verification (Webhook-Id, Webhook-Timestamp, base64-decoded secret from GET /v1/webhooks/secrets), handling secret rotation, or reacting to events like TRANSFER_PROCESSED, TRANSFER_FAILED, EXPENSE_PAYMENT_UPDATED, USER_UPDATED and REFERRAL_ACTIVATED.
Как установить скилл brex-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл brex-webhooks запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic