Major

Automate Amplitude-to-Gainsight Churn Alerts with AI

Turn Amplitude usage declines into timely, evidence-backed Gainsight CTAs. This guide shows customer success teams how to detect meaningful account risk, keep humans in control, and make the workflow auditable.

Ritvij Gautam
automate-amplitude-gainsight-churn-alerts-major-x-amplitude.png

TL;DR: what you'll build. A governed workflow that pulls Amplitude product-usage data on a schedule, checks each tracked account against its own usage baseline, and has an agent decide whether a drop looks like real risk or normal variance. When the evidence holds up, the workflow creates a Gainsight CTA for the account's Customer Success Manager, with a CSM approval step in between. The owner is the CSM or CS Ops lead who runs account health today, and the outcome is earlier, evidence-backed attention instead of a renewal surprise.

The CS problem: usage risk can hide between account reviews

Customer Success teams at B2B SaaS companies run account health through Gainsight. Health scores, renewal dates and CTAs (Calls to Action, Gainsight's term for a flagged follow-up task) all live there.

The problem is that Gainsight's health score usually updates on a schedule or from data already piped into it. Amplitude, where day-to-day product usage lives, is a separate system. A sharp week-over-week drop in a tracked account's core feature usage can sit in Amplitude for weeks without becoming a Gainsight signal, because nobody owns the manual job of cross-checking both systems for every account, every week.

By the time the CSM notices, it is often at the next scheduled account review, which might be a month away. If the renewal is also close, there is no runway left to intervene.

This is not a churn-prediction problem. A single quiet week doesn't mean an account is leaving. The goal is narrower and more honest: catch a sustained, well-supported usage decline early enough that a CSM can look into it before the account review calendar gets there on its own.

This use case sits at the intersection of two hubs Major already covers. For the broader B2B SaaS automation pattern, see AI agents for B2B SaaS. For the customer-support side, see AI agents for customer service. A related build worth reading alongside this one is how Major teams combine renewal-risk alerts from Salesforce and Zendesk into a single CSM queue; this article adds Amplitude usage as a second, earlier-firing signal into that same kind of system.

Systems and data: what moves between Amplitude and Gainsight

Amplitude: where the usage events live

Amplitude is a product analytics platform. For this workflow, the object you care about is the raw event stream: every tracked action a user takes in the product, tied to a user or account identifier.

Amplitude's Export API is a GET request to /api/2/export. It takes two required query parameters, start and end, both formatted as YYYYMMDDTHH in UTC, and returns a ZIP archive of gzip-compressed files, each containing one JSON event per line. This is a raw event dump, not an account-level rollup. Major's workflow does the aggregation itself: group events by account, count the metric that matters (logins, a core feature event, API calls), and compare that count across equivalent time windows.

Authentication is HTTP Basic: the project API key as the username and the project's secret key as the password, Base64-encoded in the Authorization header. The documented default rate limit is 4 concurrent requests and 360 requests per hour per project API key, so a daily pull for a reasonable number of projects fits comfortably inside that ceiling.

Amplitude also offers Webhooks Streaming, a destination you configure inside Amplitude's UI. This is not a native Amplitude-to-Gainsight integration. It is a configured forwarder: you pick which events to send, and Amplitude sends them as they're ingested to a URL you control. A webhook here works like a doorbell: the tool rings you when a chosen event happens, instead of you polling the door every few minutes. Amplitude attempts delivery, then retries up to nine more times over four hours on failure, with faster retries on 5xx and 429 responses, so anything receiving these events must expect occasional duplicate deliveries.

Also see Amplitude's developer API overview for the full set of surfaces and token scopes covered here.

Gainsight: where the account record and the CTA live

Gainsight NXT holds the Company (or, in some configurations, Relationship) object that represents the customer account, along with Cockpit, its workspace for CTAs. See Gainsight's API documentation overview for the full API family list.

To find the right account, the workflow queries Gainsight's Company API read endpoint: POST https://companyapi.gainsightcloud.com/v1/data/objects/query/Company. The request body specifies a select list of fields to return and a where clause with conditions and an expression to combine them, plus optional orderBy, limit and offset. The response includes the matched record's GSID, Gainsight's internal record identifier.

If account tracking is set up at the Relationship level instead of Company, the Relationship API documents the equivalent query/relationship and relationship/upsert endpoints.

Once the account is confirmed, the workflow creates a CTA through the CTA API: POST /v2/cockpit/cta/. The documentation identifies the Company ID, CTA type, CTA name and owner ID as required inputs, resolved through lookups in the sample body, and treats the external reference ID as mandatory. Optional fields like reason, priority and due date are set in the same request when supplied; date fields use YYYY-MM-DD format. Authentication is a tenant-specific access key sent in the accesskey header.

Both vendors publish rate limits: Amplitude caps at 360 Export API calls per hour per key, and Gainsight's API overview recommends staying around 100 synchronous calls per minute and 100,000 per day, though actual limits vary by package.

One honest gotcha: nothing in the CTA API documentation says the external reference ID prevents a duplicate CTA on a retry. It is described as a way to trace a request's outcome, not an idempotency guarantee, so the app has to own deduplication itself.

If any account in scope is based in the EU, GDPR Article 28 governs how a SaaS vendor processes that account's usage and success data as a processor. The practical requirement here: process only on documented instructions, keep the data secure, and log who touched what. A scoped, audited Major app satisfies that structurally, because every read and write is attributable.

Set a defensible usage-drop rule

Before building anything, the CS team needs to agree on what actually counts as a risk signal. This is a judgment call that belongs to the process owner, not a universal number.

A defensible rule needs several pieces, and the values below are illustrative starting points, not industry standards:

  • Core events, not every event. Pick the handful of Amplitude events that represent real product value for this segment (a core workflow completion, an API call, a decision-maker login), not every tracked click.
  • Account-level granularity. Roll events up by the account identifier, not by individual user, since one departing user shouldn't trigger a CTA for the whole account.
  • A trailing baseline per account. Compare this week's count to that account's own trailing average (for example, a 4-week rolling mean), not a fixed company-wide number. A 20-person account and a 2,000-person account should never share a threshold.
  • A minimum data floor. Require enough days of data in both windows before evaluating a drop, so a short export gap doesn't masquerade as a usage crash.
  • A seasonality guard. Check whether the comparison window crosses a known low-usage period (a holiday week, a fiscal-year freeze) before treating a drop as meaningful.
  • A suppression window. Once a CTA has been created or suppressed for an account, hold off re-evaluating it for a set number of days so the same signal doesn't fire repeatedly.
  • A named threshold owner. Someone on CS Ops owns the percentage or count that defines "sharp," and revisits it periodically.

None of these numbers are the point. The rule should live in one place, apply consistently, and be adjustable without rewriting the workflow.

Architecture: app state, agent judgment, workflow execution

Three pieces do three different jobs here, and keeping them separate is what makes the system auditable instead of a black box.

The workflow is deterministic. It runs on a daily schedule, pulls the Export API data, does the account-level aggregation, checks the minimum-data and suppression rules, and calls the Gainsight APIs. None of that needs a model: it is the same calculation every time, which is why it should be code, not a fresh round of reasoning.

The agent only does the step that needs judgment: given a candidate account that already passed the mechanical checks, is this decline actually worth a CSM's attention, or does it look like normal variance? The agent reads the usage trend, seasonality flags, and prior CTA history from the app, then drafts a short rationale. It never calls the Gainsight write API directly; it recommends, and the workflow executes only after a human approves.

The app holds everything that needs to persist: the account crosswalk, the usage history table, the signal log, and the CTA reference log. A model's context window resets between runs; the app's managed database doesn't. Think of the app as the CSM's shared notebook that never gets erased, instead of the agent trying to remember everything in its head.

Architecture diagram showing Amplitude Export API feeding a Major app's usage tables, an agent evaluating risk, a CSM approval gate, and Gainsight Company lookup and CTA creation

Amplitude usage-drop to Gainsight CTA architecture: workflow, app, agent and governed credentials

The split keeps cost and risk where they belong. Rate-limited API calls, aggregation math and record matching run as code, cheaply and the same way every time. The one place real ambiguity exists is reserved for the model, and even that recommendation gets a human check before it reaches the customer-facing system.

Build the workflow on Major, step by step

  1. Connect Amplitude and Gainsight once, through IT. Amplitude has no official Major connector in the catalog today, so set it up as a custom API connector using the Export API base URL and the Basic-auth key pair; Gainsight gets a custom API connector scoped to the tenant's API host, with the accesskey stored as a secret, never typed into a prompt. Both credentials live in Major's central credential store, and every app, agent and workflow that touches either tool reuses the same governed connection. You should see both connectors listed as available resources with their scopes documented and no raw key anywhere in a workflow or prompt.
  2. Build the Usage Risk app with three managed tables: an account crosswalk (Amplitude account key to Gainsight GSID), a usage history table (account, interval, event count, baseline), and a signal log (signal key, status, CTA reference, rationale, timestamps). Add a CSM-facing screen listing candidate accounts with their trend chart and the agent's draft rationale, with Approve and Suppress buttons. You should see a working queue view with zero rows before the first scheduled run.
  3. Add the agent that uses this app. Give it read access to the usage history and crosswalk tables and write access only to a recommendation field, never to Gainsight directly. Its instructions restrict it to judgment: confirm the account has enough data, check for a plausible seasonal explanation, and draft a short rationale citing the actual numbers.
Example agent prompt: "Given this account's trailing 4-week usage average, the current week's count, and any note about known seasonal patterns or recent renewal conversations, decide if this week's decline looks like genuine risk or explainable variance. If risk, draft a two-sentence rationale citing the specific numbers. Never create or modify a Gainsight record yourself; only write your recommendation to the signal row."
  1. Set the workflow's trigger as a daily schedule that runs after the prior day's Amplitude data has landed (export lag means forwarded events alone aren't enough for completeness). The workflow calls the Export API for the prior window, aggregates by account, checks the minimum-data and suppression rules, writes qualifying candidates to the signal log, then calls the agent for each one. You should see new rows in the signal log the morning after the first scheduled run.
  2. Test the whole path with a seeded test account: fake a usage drop in a sandboxed Amplitude project or a mocked Export API response, confirm the workflow flags it, confirm the agent's rationale cites the right numbers, and confirm the Gainsight Company query matches the test record without writing a real CTA. You should see the full chain working before any production write is enabled.
  3. Roll out with permissions: give CS read/approve access to the queue screen, restrict the CTA-create step to require CSM approval, and give CS Ops admin access to adjust thresholds. You should see the Approve action trigger the Gainsight write and log the returned GSID and CTA reference back into the signal row.

Once approved, the workflow executes the deterministic write: it queries Gainsight's Company endpoint for the matched account, then calls POST /v2/cockpit/cta/ with a stable, internally generated referenceId, the account's GSID, the CSM as owner, a due date, and the agent's rationale as the CTA description. The app stores the returned GSID and the referenceId in the signal log immediately, before confirming success, so a retry after a timeout checks the log first rather than firing a second CTA.

Data flow diagram showing a usage signal moving through completeness and baseline checks, an agent-drafted rationale, CSM approval, and either a Gainsight CTA write or a logged suppression

Signal-to-CTA approval path: what runs straight through code versus what a CSM reviews

This is the picture worth keeping in mind for the whole build: most of the path is deterministic checks a machine can run every day without supervision, and only the narrow middle, where real judgment is needed, touches the model and a person.

Governance and IT control

Everything in this workflow runs behind the same controls Major applies to every app and agent, and each one maps onto a real risk in this process.

  • SSO and role-based access mean only CS and CS Ops see the usage-risk queue, and only CSMs can approve a CTA for their own book of accounts.
  • Scoped credentials through the credential proxy mean the Amplitude key only has export/read scope, and the Gainsight key only has Company-lookup and CTA-create scope, nothing broader. Neither credential appears in an agent's prompt or in workflow code.
  • Audit logs record every Export API pull, every Gainsight query, every agent recommendation, every CSM approval or suppression, and every CTA write, with timestamps and the acting identity.
  • Managed database and storage hold the crosswalk, history and signal tables, so the account's full risk history survives staff turnover and model changes.
  • Versioned deploys mean a change to the threshold rule or the agent's instructions is tracked, not a silent edit to a live prompt.
  • Approval gates require a CSM sign-off before any Gainsight write; the workflow never auto-creates a customer-facing CTA.

If account data includes EU customers, GDPR Article 28 is the relevant control point: Major's audit trail and access scoping let the CS team demonstrate processing only on documented instructions. For SaaS vendors with a SOC 2 audit, the same audit-log and access-control evidence supports the Trust Services Criteria around security and processing integrity, without this workflow itself being a compliance certification.

Failure handling and edge cases

Cross-system automation fails in boring, predictable ways, and the workflow needs an explicit answer for each one.

  • Amplitude rate limits (429s). Back off and retry within the documented 360-requests-per-hour ceiling; never silently drop a day's pull.
  • Partial or failed exports. If the ZIP archive for an hour range is missing files or fails to parse, flag the gap in the usage history table rather than treating missing data as zero, which would create false drops.
  • Webhook redelivery. If you also use Amplitude's event-forwarding webhook for faster detection, expect duplicate deliveries per its documented retry behavior; dedupe on the event's own identifier before writing to the app.
  • Missing or ambiguous account match. If the Gainsight Company query returns zero or more than one match for an Amplitude account key, do not guess. Route it to a manual-match queue instead of creating a CTA against the wrong account.
  • Low-volume accounts. Very small accounts can show a large percentage swing from a tiny absolute change. Apply the minimum-data floor here, and consider a minimum absolute-count threshold alongside the percentage rule.
  • Duplicate CTA prevention. Because Gainsight's referenceId is not a documented idempotency guarantee, the app checks its own signal log for an existing open CTA before calling the create endpoint again.
  • Gainsight write failures. If the CTA create call fails after a CSM has approved it, retry with backoff and surface the failure in the app; never let a failed write look the same as a successful one.
  • What the agent must never do. It never calls the Gainsight write API, never auto-approves its own recommendation, and never treats one week of data as a churn verdict. Missing history, unclear seasonality or an existing open CTA all get routed to the CSM instead of resolved silently.

A worked example with numbers

For example, consider a fictional company, Northstar Labs, a 40-person CS team managing several hundred mid-market accounts in Gainsight.

One tracked account, built around a core "report generated" event, shows a usage count of 1,000 in one seven-day window and 620 in the next equivalent seven-day window, a 38% decline. This is an illustrative input to walk through the logic, not a universal threshold to copy.

The workflow runs its mechanical checks first. Event completeness for both weeks is above the minimum floor, so the data is trustworthy. The account's feature history shows "report generated" has been a stable, heavily used action for six months, so this isn't a feature the account never adopted. The calendar shows no seasonal dip in this window, and there is no existing open CTA, so it isn't a duplicate signal.

With the mechanical gates passed, the agent reviews the trend and writes: "Report-generation activity fell 38% week-over-week against a stable 6-month baseline, with no seasonal explanation and no concurrent product outage. Recommend a check-in CTA to confirm there isn't a workflow blocker before the renewal review." The agent recommends; it does not create anything yet.

The CSM reviews the entry, sees the trend chart and rationale, and approves it. The app queries Gainsight's Company endpoint for Northstar Labs' matching record, retrieves its GSID, and calls POST /v2/cockpit/cta/ with a generated referenceId, the CSM as owner, a 5-business-day due date, and the agent's rationale as the description. The returned GSID and referenceId are stored in the signal log.

Before this workflow existed, a CSM covering 60 accounts might have caught this kind of decline only at the next scheduled review, two to four weeks away. With the daily aggregation and approval queue in place, the same decline surfaces the next business day, giving the CSM roughly three extra weeks of runway before the renewal conversation. That gap, not a churn-prevention guarantee, is the actual value of running this earlier.

What to measure

Track these against your own baseline; none of the numbers below are targets, only definitions to track.

  • Candidate precision after review: the share of agent-flagged candidates the CSM approves versus suppresses, which tells you if the threshold is too loose or too tight.
  • Suppression and approval rates over time: a rising suppression rate might mean the baseline window needs adjusting for a segment.
  • Duplicate CTA count: should stay at zero; any nonzero count means the dedup check needs attention.
  • Mapping failures: how often the crosswalk fails to resolve an account, which points at upstream data-hygiene work.
  • Time from signal to CSM action: how long a flagged candidate sits in the queue before being approved or suppressed, the actual process metric this workflow exists to shrink.

Frequently asked questions

Can Amplitude send churn alerts directly to Gainsight?

No. Amplitude's Webhooks Streaming forwards selected events to a URL you configure, and Gainsight's CTA API accepts writes from an authorized caller, but there is no built-in, turnkey link between the two. The handoff has to be built, typically as a custom API connector and app that aggregates Amplitude data and writes to Gainsight's CTA endpoint.

How should a team define a product-usage drop?

Define it against the account's own trailing baseline, not a fixed company-wide number, using events that represent real product value for that segment. Require a minimum amount of data in both comparison windows, account for known seasonal dips, and name one owner for the threshold. There is no universal percentage that works across every account size.

How do you prevent duplicate Gainsight CTAs?

Store a stable internal signal key and the CTA's creation state in your own system before calling the create endpoint, and check that log on every retry. Gainsight's CTA API documentation does not say the external referenceId guarantees idempotency, so duplicate prevention has to live in the app, not the API.

What data is needed to match an Amplitude account to Gainsight?

You need a shared, stable identifier between the two systems, or a maintained crosswalk table mapping Amplitude's account key to a specific Gainsight Company or Relationship record. When a match is ambiguous or missing, route it to manual review rather than guessing, since writing a CTA to the wrong account damages trust in the health process.

Can AI decide whether a usage drop means churn?

An agent can read the usage trend, check for plausible explanations, and draft a rationale for a CSM to review, but it shouldn't declare churn on its own. The judgment call on ambiguous or high-impact accounts stays with the CSM, with the agent's output treated as a recommendation that still needs approval before anything customer-facing happens.

What happens if Amplitude's data export is incomplete for a day?

Treat an incomplete export as insufficient data for that account's window rather than evaluating a partial count, since a short gap can look identical to a real usage crash. Flag the gap and re-evaluate once a complete window is available.

Before you go live

Run through this list with CS Ops and IT before the workflow touches a live Gainsight tenant. Each item maps to a failure mode covered above, so treat a "no" as a reason to hold the rollout rather than a nice-to-have.

  • [ ] Amplitude Export API credentials scoped to read-only and stored in the credential proxy, not in a prompt
  • [ ] Gainsight accesskey scoped to Company lookup and CTA create only
  • [ ] Account crosswalk table populated and spot-checked for at least a sample of active accounts
  • [ ] Threshold, baseline window and suppression period agreed and owned by a named person on CS Ops
  • [ ] Test run completed against a sandboxed or mocked account with no live Gainsight write
  • [ ] CSM approval gate confirmed in front of every Gainsight CTA creation
  • [ ] Duplicate-CTA check verified by replaying the same signal twice
  • [ ] Alerting in place for Export API failures, mapping failures, and Gainsight write failures

Once every box is checked, roll out to one CSM's book of accounts first, watch the queue and the audit log for a week, and only then open it to the full team.

More b2b saas AI automation use cases

Start building on Major

Build a governed Amplitude-to-Gainsight workflow on Major that keeps account usage history, evaluates risk with an agent, and routes approved evidence into a scoped CTA.

Related articles

About the author

Ritvij Gautam is Head of Growth at Major.

Last reviewed November 11, 2026 by Ritvij Gautam.

Frequently asked questions

Can Amplitude send churn alerts directly to Gainsight?
No. Amplitude's Webhooks Streaming forwards selected events to a URL you configure, and Gainsight's CTA API accepts writes from an authorized caller, but there is no built-in, turnkey link between the two. The handoff has to be built, typically as a custom API connector and app that aggregates Amplitude data and writes to Gainsight's CTA endpoint.
How should a team define a product-usage drop?
Define it against the account's own trailing baseline, not a fixed company-wide number, using events that represent real product value for that segment. Require a minimum amount of data in both comparison windows, account for known seasonal dips, and name one owner for the threshold. There is no universal percentage that works across every account size.
How do you prevent duplicate Gainsight CTAs?
Store a stable internal signal key and the CTA's creation state in your own system before calling the create endpoint, and check that log on every retry. Gainsight's CTA API documentation does not say the external referenceId guarantees idempotency, so duplicate prevention has to live in the app, not the API.
What data is needed to match an Amplitude account to Gainsight?
You need a shared, stable identifier between the two systems, or a maintained crosswalk table mapping Amplitude's account key to a specific Gainsight Company or Relationship record. When a match is ambiguous or missing, route it to manual review rather than guessing, since writing a CTA to the wrong account damages trust in the health process.
Can AI decide whether a usage drop means churn?
An agent can read the usage trend, check for plausible explanations, and draft a rationale for a CSM to review, but it shouldn't declare churn on its own. The judgment call on ambiguous or high-impact accounts stays with the CSM, with the agent's output treated as a recommendation that still needs approval before anything customer-facing happens.
What happens if Amplitude's data export is incomplete for a day?
Treat an incomplete export as insufficient data for that account's window rather than evaluating a partial count, since a short gap can look identical to a real usage crash. Flag the gap and re-evaluate once a complete window is available.