Events
Subscribe to any of these, or to* for all of them.
The
contact.* event names stay as they are even though the product calls these records People. Every company.*, contact.* and signal.created event names where it came from in a source field, so you can ignore changes your own integration made. See Sources. A Company that POST /people creates for an unknown accountExternalId fires company.created but doesn’t start Company-created Flows.
Creating or changing a subscription needs the read scope for each event: read:companies for company.*, read:contacts for contact.*, read:signals for signal.created, and read:surveys for survey.* and survey_response.*. member.* events need none, and * needs all four. A key without one gets a 403.
Create a subscription
Register an endpoint with the events you care about. The signingsecret is returned only in this response, so store it now.
Payload
Every delivery is a JSON POST with this envelope:timestampis when the change happened. For a sync it is the time the record changed, which can be minutes before delivery.sourcesays what caused the event. It is oncompany.*,contact.*andsignal.createdevents. See Sources.changedFieldsis oncompany.updatedandcontact.updatedwhen GainTrace knows which fields changed. It lists the public field names (for API writes, the fields sent in the request), such as["plan"]. It is absent when the fields aren’t known.datais the record as the matchingGETreturns it. Forsignal.createdthat isGET /signals/{id}, soaccountIdis the legacy record id andcompanyIdis the Company id.
Sources
Thesource field on a company.*, contact.* or signal.created event names what caused it:
survey.*, survey_response.* and member.* events have no source on the envelope. A survey_response payload has its own source inside data, which names where the answer came from.
PATCH or upsert always fires an update, with changedFields set to the public fields in the request, whether or not their values changed. A change to a value GainTrace computes, such as healthScore, healthStatus, contactCount, dealCount or lastActivityAt on a Company, or lastSeenAt and engagementScore on a Person, doesn’t fire an event.
Syncs, imports and bursts
A connection sync, a CSV import or a batch job can change thousands of records at once. GainTrace keeps the volume manageable:- One event per record per run. A record that was created and then updated in the same run arrives once, as
*.created, with its final state. - Unchanged records send nothing. A record a sync re-reads without any public change fires no event.
- Batches are paced. Events from syncs, imports and batch jobs such as signal detection are sent after the run finishes, in paced batches. They start within about a minute, and a large first sync arrives over time. One endpoint’s backlog doesn’t delay another endpoint’s events. A run that stops early is flushed after 15 idle minutes.
- Order isn’t guaranteed. Use
timestampto order events, andGETthe record when you need its current state. - Dedupe on the delivery id.
X-GainTrace-Deliverystays the same across retries. GainTrace queues a sync, import or signal event once per endpoint.
Company, person and member payloads
company.createdandcompany.updatedsend the Company asGET /companies/{id}returns it.contact.createdandcontact.updatedsend the Person asGET /people/{id}returns it.contact.deletedsends only the record that was removed. Deleting a Person byexternalIdoremailremoves their records at every Company, and sends one event for each. Changing a Person’semailthrough the API moves the whole Person, so you get acontact.updatedwithchangedFieldsof["email"]for each Company they belong to.member.invitedandmember.joinedsend the teammate’semailandrole.
Survey response payload
survey_response.* events carry the response as your team sees it in the response inbox:
bandispositive,neutral,negativeorunscored(custom surveys and responses without a score): NPS uses promoters (9-10), passives (7-8) and detractors (0-6); CSAT and CES use the top two points and the bottom half of their scale.channelisemail,in_app,apiorimportfor new answers.qr,kioskandlinkare historical values that appear only on answers collected before public links were removed. Imported and API-ingested NPS hassurveyId: nulland names its provider insource, for exampleapi:retently.questionAnswerspairs each answer with its question text, in question order. Statements and unanswered questions are left out. Theanswerskeysq0,q1and so on match itskey.subjectis the deal, ticket, plan or custom record the response is about, ornull.- Imported scores (
channelofimport) carry the provider’s id asexternalId, an emptyanswersand noquestionAnswers. They cover NPS, CSAT and CES. - Anonymous surveys send
personId,respondentEmail,respondentNameandsubjectasnull. - Internal reviewer notes never leave GainTrace.
Verify the signature
Compute an HMAC-SHA256 of the raw request body with your webhook secret, hex-encode it, prefixsha256=, and compare it to X-GainTrace-Signature with a constant-time check. Reject any request that does not match.
Sign the raw bytes, before any JSON parsing or re-serialization. Reparsing
and re-stringifying can reorder keys and break the signature.
Custom headers
For an extra layer of authentication, attach custom headers that your receiver checks (for example a shared secret or bearer token). They are sent with every delivery.Content-Type, X-GainTrace-*, Host, …) cannot be set. Header values may hold secrets, so they are redacted (***) in every API response. Max 20 headers, 4KB total.
Delivery and retries
- Immediate. Delivery is attempted the moment the event fires. Events from a sync, an import or a batch job wait for the delivery sweeper instead, which runs every minute. See Syncs, imports and bursts.
- Respond fast. Return a
2xxwithin 10 seconds. A non-2xx, a timeout, or a connection error counts as a failure. - No redirects. GainTrace does not follow redirects. A
3xxresponse counts as a failure, so register the final URL. - Retried with backoff. A failed delivery is retried after 1, 2, 4, 8 and 16 minutes (6 attempts in total, about 30 minutes), then marked failed.
- Auto-disabled. After 15 consecutive failed deliveries the endpoint is disabled (
disabledAtis set andactivebecomesfalse). A successful delivery resets the count. Fix your receiver, then re-enable it.
Test an endpoint
Send a signedping to your endpoint at any time and get the result back: