2 operations. Every schema and example on this page is generated from the platform contract.
Auto-generated merchant insight cards for the Business-app Home screen, derived from recent loyalty activity: the busiest day of the week, week-over-week activity trend, customers within two stamps of their reward, and pending stamp approvals, with a friendly welcome fallback when there is nothing to show.
Store whose insight cards to generate (also authorises the merchant).
Stable insight identifier (e.g. busiest_day, pending_approvals).
Short card headline.
One-line insight body copy.
Relative importance for ordering / styling.
lowmediumhighCTA button label when the card is actionable.
App deeplink the CTA opens when actionable.
Whether the merchant can dismiss the card.
ISO timestamp after which the card should hide, when time-bound.
curl -G "https://www.membber.com/api/v1/insights" \
-H "Authorization: Bearer $MEMBBER_TOKEN" \
--data-urlencode "store_id=6659c139-0000-4000-8000-d0c500000066"import { createMembberClient } from "@membber/sdk-ts";
const membber = createMembberClient({
getAccessToken: () => process.env.MEMBBER_TOKEN,
});
const { data, error } = await membber.raw.GET("/api/v1/insights", {
params: { query: { store_id: "6659c139-0000-4000-8000-d0c500000066" } },
});
if (error) {
// Typed error envelope: { error: { code, message, requestId } }
throw new Error(`${error.error.code}: ${error.error.message}`);
}
console.log(data);import MembberSwift
let client = MembberClient(
serverURL: MembberClient.productionServerURL,
tokenProvider: { session.accessToken }
)
let response = try await client.api.getStoreInsights(
query: .init(storeId: "6659c139-0000-4000-8000-d0c500000066")
).ok.body.json
print(response){
"insights": [
{
"id": "00000d1b-0000-4000-8000-d0c500000000",
"title": "Morning class",
"body": "<body>",
"impact_level": "low",
"action_label": "<action_label>",
"action_deeplink": "<action_deeplink>",
"dismissible": true,
"expires_at": "<expires_at>"
}
]
}The Home-screen 'Bring them back' Pulse headline: the count of a store's members whose pre-computed churn risk is medium or high (the retention audience), split into medium and high bands. Store-scoped and business-authed; every value is real store data and anonymized or archived customers are excluded via the reportable-customers guard.
Store whose at-risk member count to read (also authorises the merchant).
Members with churn_risk medium OR high, the retention audience (medium + high).
Members with churn_risk = medium.
Members with churn_risk = high.
ISO 8601 timestamp when this count was read (churn_risk is refreshed hourly).
curl -G "https://www.membber.com/api/v1/insights/at-risk" \
-H "Authorization: Bearer $MEMBBER_TOKEN" \
--data-urlencode "store_id=6659c139-0000-4000-8000-d0c500000066"import { createMembberClient } from "@membber/sdk-ts";
const membber = createMembberClient({
getAccessToken: () => process.env.MEMBBER_TOKEN,
});
const { data, error } = await membber.raw.GET("/api/v1/insights/at-risk", {
params: { query: { store_id: "6659c139-0000-4000-8000-d0c500000066" } },
});
if (error) {
// Typed error envelope: { error: { code, message, requestId } }
throw new Error(`${error.error.code}: ${error.error.message}`);
}
console.log(data);import MembberSwift
let client = MembberClient(
serverURL: MembberClient.productionServerURL,
tokenProvider: { session.accessToken }
)
let response = try await client.api.getAtRiskCount(
query: .init(storeId: "6659c139-0000-4000-8000-d0c500000066")
).ok.body.json
print(response){
"at_risk_count": 1,
"medium": 1,
"high": 1,
"as_of": "<as_of>"
}