Skip to main content

Activation API

The activation router manages score-driven activation targets. Push scores and tier changes to Salesforce fields, trigger Customer.io segments, and send Slack alerts when accounts cross tier thresholds.

Router namespace: activation

Source: src/server/trpc/routers/activation.ts

Procedures

ProcedureTypeAccessDescription
getConfigquerytenantCurrent activation target configuration
updateConfigmutationadminUpdate activation targets
getRecentRunsqueryadminRecent activation run history
triggerActivationmutationadminManually trigger activation to selected targets

getConfig

Returns the current activation configuration including Salesforce push settings, Customer.io segment mappings, and Slack alert configuration.

activation.getConfig.queryOptions()

Input

None.

Response

{
"salesforce": {
"enabled": true,
"pushScores": true,
"pushTiers": true,
"fieldMappings": {
"fitScore": "Fit_Score__c",
"engagementScore": "Engagement_Score__c",
"tier": "Score_Tier__c"
}
},
"customerio": {
"enabled": true,
"segmentByTier": true,
"tierSegmentPrefix": "score_tier_"
},
"slack": {
"enabled": false,
"webhookConfigured": false,
"alertOnTierChange": true,
"alertTiers": ["hot"]
}
}

updateConfig

Updates activation target configuration. Partial updates are supported -- only include the targets you want to change.

activation.updateConfig.mutationOptions(options)

Access: Admin only

Input

FieldTypeRequiredDescription
salesforceobjectNoSalesforce push configuration
salesforce.enabledbooleanNoEnable/disable Salesforce push
salesforce.pushScoresbooleanNoPush numeric scores to CRM fields
salesforce.pushTiersbooleanNoPush tier labels to CRM fields
customerioobjectNoCustomer.io segment configuration
customerio.enabledbooleanNoEnable/disable Customer.io segments
customerio.segmentByTierbooleanNoAuto-segment contacts by tier
slackobjectNoSlack alert configuration
slack.enabledbooleanNoEnable/disable Slack alerts
slack.alertOnTierChangebooleanNoAlert when entities change tier
slack.alertTiersstring[]NoWhich tiers trigger alerts

Response

{ "success": true }

Example

const trpc = useTRPC();

const mutation = useMutation(
trpc.activation.updateConfig.mutationOptions({
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: trpc.activation.getConfig.queryKey(),
});
},
})
);

mutation.mutate({
slack: { enabled: true, alertTiers: ["hot", "warm"] },
});

getRecentRuns

Returns recent activation run history with status and target details.

activation.getRecentRuns.queryOptions(input)

Access: Admin only

Input

FieldTypeRequiredDefaultDescription
limitnumber (1-100)No20Maximum runs to return

Response

[
{
"id": "run_abc123",
"startedAt": "2026-03-05T10:30:00.000Z",
"completedAt": "2026-03-05T10:30:45.000Z",
"status": "completed",
"targets": ["salesforce", "customerio"],
"entityCount": 340,
"errors": []
}
]
StatusDescription
completedAll targets activated successfully
partialSome targets failed (check errors array)
failedActivation failed entirely

triggerActivation

Manually triggers activation to one or more targets. Normally activation runs automatically after scoring, but this allows ad-hoc pushes.

activation.triggerActivation.mutationOptions(options)

Access: Admin only

Input

FieldTypeRequiredDescription
targets("salesforce" | "customerio" | "slack")[]YesTargets to activate

Response

{
"runId": "run_def456",
"status": "completed",
"results": {
"salesforce": { "success": true, "entitiesPushed": 340 },
"customerio": { "success": true, "segmentsUpdated": 4 }
}
}
tip

Trigger activation after manual scoring runs or configuration changes to push updated scores immediately rather than waiting for the next scheduled run.