Skip to content

happ

Happ Platform → NetHunt CRM + Slack. One integration, one set of NetHunt credentials, several webhook endpoints — grouped here because they all write the same CRM from Happ-owned event sources. Replaces the former Make.com scenarios.

Endpoints

All are POST under the gateway prefix /happ and share the same webhook_secret body field (injected by cf-proxy; enforced only when WEBHOOK_SECRET is set).

EndpointSourceDoes
/happ/webhook/platform-eventsplatform-api lifecycle eventsUpserts the funnel record (by email), records payments, Slack alerts
/happ/webhook/leadspublic marketing formCreates a contact, then a source-routed lead record

platform-events

Upserts one NetHunt "Воронка Платформа" record per user (keyed on email), advancing Этап forward-only by the event's stage rank. New users also get a "Контакты" record; payments append to "Продажи Платформа". credits.* / subscription.expiring_soon events additionally post to the Slack alerts webhook. Idempotent on idempotency_key (24h dedup). Wire contract: LifecycleEventBuilderService in platform-api.

leads

source routes the lead folder: platform/instagram → Первая продажа, labs → Продажи Labs (others → default). Always creates a contact first, then the lead (Этап=Упала заявка, Источник=Сайт) linked back to it. Create-only, no dedup.

Config (D1 config, editable via integ-admin)

Folder ids and field-name maps for both flows live in src/config/defaults.ts (nethunt_folders, funnel_fields, sales_fields, stage_labels, alert_events, leads_folders, leads_fields, leads_static, …). NetHunt is keyed by display name, so the field maps are the RU column labels.

Credentials (D1 creds, via integ-admin or scripts/cli.ts creds:set happ <k> <v>)

NETHUNT_EMAIL, NETHUNT_API_KEY, WEBHOOK_SECRET, SLACK_ALERTS_WEBHOOK_URL (optional).

Deploy

Trunk-based. Run POST /happ/setup once per env, then set creds. Same tag-promotion flow as every integ-core integration (release.ymldeploy-prod.yml).