Developers
CI event validation
Check your event payloads in CI so a broken event fails the build instead of reaching SaaSFunnels.
If your repository keeps example event payloads, check them on every pull request. Validation runs locally and needs no key.
Add example payloads
Save one JSON file per event your server sends, using placeholder IDs:
{
"event_id": "evt_001",
"event_name": "usage_limit_hit",
"account_id": "acct_123",
"user_id": "user_456",
"timestamp": "2026-11-20T15:00:00.000Z",
"properties": { "plan": "starter", "limit_name": "monthly_events" }
}saasfunnels events sample --source direct prints a starting point.
Validate them
npx saasfunnels events validate ./saasfunnels/events/usage-limit-hit.json --source direct --jsonThe command exits with 1 when a payload is invalid, for example when account_id is missing, an event name is too long, or a field looks like an email address or a secret. A missing event_id shows as a warning in the JSON output but doesn't fail the build.
GitHub Actions example
name: SaaSFunnels events
on: pull_request
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: |
for file in saasfunnels/events/*.json; do
npx saasfunnels events validate "$file" --source direct --json
doneThis assumes saasfunnels is in your devDependencies. Pin its version so results don't change between runs.
Keep keys out of validation jobs
Validation-only jobs don't need SAASFUNNELS_API_KEY or SAASFUNNELS_INGEST_API_KEY. Don't add them.
If a staging job should send a real test event, store an Event ingestion key for a test workspace in your CI secrets and run:
npx saasfunnels events send-test --file ./saasfunnels/events/usage-limit-hit.json --jsonKeep this out of ordinary pull-request runs.