# Automate closed testing with developerpact This file: https://developerpact.com/automate.md Google Play asks a new personal developer account for 12 testers who stay opted in for 14 days before an app can go to production. developerpact is an exchange where developers test each other's apps, and a small SDK measures, per tester per day, whether each one really opened the app. This guide is for running that from your own development pipeline: the CI job, release script or AI agent that already builds and ships your app. The pipeline registers the app, ships the SDK, tells developerpact when the build is live, and hears back — through signed webhooks — whenever a tester joins, slips, goes silent or leaves. Nobody has to keep the site open. ## What you need - A developerpact account (sign in with Google at https://developerpact.com). - An API key: **https://developerpact.com/me → API keys → Create**. It is shown once. Store it as a secret, for example `DEVELOPERPACT_API_KEY`. *Human step.* - An Android app on Google Play with a closed testing track. A brand-new app's first bundle has to be uploaded from Play Console by hand; Google's API refuses it before that. *Human step.* - An HTTPS endpoint your pipeline controls, if you want events pushed to you. Every call is JSON over HTTPS to `https://developerpact.com/api/integrations/v1` with `Authorization: Bearer $DEVELOPERPACT_API_KEY`. A key acts as its owner, on the owner's own apps, and nothing else. Failures answer `{ "ok": false, "error": "…" }` with 401 (unknown key), 404 (not your app), 409 or 422 (bad body). ## The pipeline, step by step ### 1. Register the app Idempotent on the package name: a second call returns the app that is already there (`200, created: false`) instead of a duplicate. ```bash curl -sS -X POST https://developerpact.com/api/integrations/v1/apps \ -H "Authorization: Bearer $DEVELOPERPACT_API_KEY" \ -H "content-type: application/json" \ -d '{ "name": "My App", "packageName": "com.example.myapp", "rosterMode": "group", "groupUrl": "https://groups.google.com/g/myapp-testers", "tracking": "sdk", "seatsWanted": 16, "rules": { "thresholdSeconds": 60, "silentDays": 3, "termDays": 17 } }' ``` Keep `app.id` from the answer; every later call uses it. Ranges are refused, not clamped: seats 12–20, threshold 30–180 seconds, silent days 2–5, term 14–28 days. `rosterMode: "group"` suits a pipeline: testers join your Google Group themselves and the pipeline never handles their addresses. ### 2. Add the SDK to the app One dependency and one line in `main()`. The integration has its own file, written for a coding agent: - Flutter: https://developerpact.com/sdk/flutter.md - Any other stack: https://developerpact.com/sdk/rest.md Hand the agent that URL, or do it in the pipeline the way the file says. The SDK needs no key and no manifest change. ### 3. Ship the build to the closed track Build the signed bundle and upload it to the closed testing track with Google's Play Developer API, as your pipeline already does for releases. Put your Google Group on the track's testers. Add your own Play account to the group, so your phone can send the first heartbeat. ### 4. Tell developerpact the track is live ```bash curl -sS -X POST https://developerpact.com/api/integrations/v1/apps/$APP_ID/transition \ -H "Authorization: Bearer $DEVELOPERPACT_API_KEY" -H "content-type: application/json" \ -d '{ "transition": "track_ready" }' curl -sS -X POST https://developerpact.com/api/integrations/v1/apps/$APP_ID/checklist \ -H "Authorization: Bearer $DEVELOPERPACT_API_KEY" -H "content-type: application/json" \ -d '{ "which": "B", "ticks": { "releaseLive": true, "optInLive": true } }' ``` The app opens for testers on its own once the release is live and your own phone has sent the first heartbeat — install the build from the opt-in link once. From then on it is on the board and testers join from your invite link. ### 5. Hear what happens Register your endpoint. The answer carries the signing secret; it is new on every call, so store it then. ```bash curl -sS -X PUT https://developerpact.com/api/integrations/v1/webhook \ -H "Authorization: Bearer $DEVELOPERPACT_API_KEY" -H "content-type: application/json" \ -d '{ "url": "https://ci.example.com/hooks/developerpact" }' # → { "url": "…", "secret": "whsec_…" } curl -sS -X POST https://developerpact.com/api/integrations/v1/webhook/test -H "Authorization: Bearer $DEVELOPERPACT_API_KEY" ``` Every minute, new events of your apps are delivered as a `POST` with these headers: - `x-developerpact-event`: the event type - `x-developerpact-delivery`: an id that stays the same across retries — deduplicate on it - `x-developerpact-signature`: `t=,v1=.")>` Check the signature before trusting the body, and refuse one older than five minutes: ```ts import { createHmac, timingSafeEqual } from "node:crypto"; export function verify(rawBody: string, header: string, secret: string): boolean { const parts = Object.fromEntries(header.split(",").map((p) => p.split("=") as [string, string])); const t = Number(parts.t); if (!Number.isFinite(t) || Math.abs(Date.now() / 1000 - t) > 300) return false; const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex"); const given = Buffer.from(parts.v1 ?? "", "hex"); return given.length === expected.length / 2 && timingSafeEqual(given, Buffer.from(expected, "hex")); } ``` Answer any 2xx once it is handled. Anything else is retried after 1, 5, 30, 120, 360 and 1440 minutes; delivery is at least once. The events, and what a pipeline usually does with them: | Event | Means | Typical action | | --- | --- | --- | | `testing.silent` | A tester has had no active day for a while | Alert; nudge or replace them | | `testing.at_risk` | A tester is missing days | Warn | | `testing.never_installed` | Listed, but the app never reported from their phone | Warn | | `testing.left`, `testing.dropped`, `testing.released` | A seat opened | Alert; a new tester is needed | | `testing.joined`, `testing.completed` | A tester joined, or finished the term | Info | | `app.risk_changed` | The count crossed a line; `data.to` is `ok`, `below_target`, `no_buffer` or `below` | Error on `below`, warning on `no_buffer` | | `app.sdk_missing` | Testers' phones stopped reporting | Error: check the live build still has the SDK | | `app.opened`, `app.sdk_verified`, `app.status_changed` | The app moved on | Info | The body names no person: `{ "v": 1, "id", "type", "at", "app": { "id", "name", "packageName", "status", "seatsWanted", "onTrackCount", "riskLevel", "earliestApplyDate", "url" }, "testingId", "data" }`. Who it was is on the ledger at `app.url`. ### 6. Know when to apply ```bash curl -sS https://developerpact.com/api/integrations/v1/apps/$APP_ID -H "Authorization: Bearer $DEVELOPERPACT_API_KEY" ``` The answer has live `counts` (active, onTrack, installed, atRisk, silent, notPaired), the `buffer` above what Google asks for, and `earliestApplyDate`. Once 12 testers have stayed 14 days, apply for production in Play Console with the engagement summary from the ledger, then record it: ```bash curl -sS -X POST https://developerpact.com/api/integrations/v1/apps/$APP_ID/transition \ -H "Authorization: Bearer $DEVELOPERPACT_API_KEY" -H "content-type: application/json" \ -d '{ "transition": "applied" }' ``` `granted` closes the test when Google says yes; `test_again` reopens it when Google asks for another round. ## In an AI work pipeline When an agent does the building, give it this file and the key, and let it own steps 1 to 6: 1. **Plan:** the agent reads this file and the SDK file for the app's stack. 2. **Build:** it registers the app, adds the SDK and builds the signed bundle. 3. **Ship:** it uploads to the closed track and records `track_ready` and `releaseLive`. 4. **Watch:** your webhook handler turns events into tasks — a `testing.silent` becomes "replace a tester", an `app.sdk_missing` becomes "the last build lost the SDK, fix and re-ship". 5. **Finish:** when `earliestApplyDate` has passed and `onTrack` holds, it asks you to apply in Play Console. A ready prompt for the agent: > Read https://developerpact.com/automate.md and wire developerpact into this project's release pipeline as it describes. Use the API key in the DEVELOPERPACT_API_KEY environment variable and never print it. Do the code and pipeline steps yourself; for anything the document marks as needing the human — creating the key, Play Console, the first upload — stop and give me the exact instructions. ## What stays with a human - Creating the API key, and deciding where it is stored. - The first upload of a brand-new app, and Play Console's App content and Data safety forms. - Testing other developers' apps back. developerpact is an exchange: each seat you take is an app you open for a minute a day. Your pipeline cannot do that part for you.