API referenceMarketing

Marketing

1 operation. Every schema and example on this page is generated from the platform contract.

Everything this store has sent its customers, newest first.

One feed of every marketing message that actually left the store, from every source: Moments the system sent by itself, retention journeys, and campaigns somebody wrote. Each row carries the person, the reason, the channel, what was said and what happened. Nothing appears here that was queued, suppressed, capped or held back, so the list is exactly what customers received. Figures are counted from the store own rows: a store that has sent nothing gets zeroes.

Parameters

store_idstring · uuidqueryrequired

Store whose marketing to list (also authorises the merchant).

limitintegerqueryoptional

Page size (default 50, max 200).

beforestringqueryoptional

Keyset cursor: the previous page's `next_before`. Returns older sends.

before_idstring · uuidqueryoptional

The previous page's `next_before_id`. Breaks the tie between two sends sharing a timestamp. Omitting it is safe but can repeat one row at a page boundary.

customer_idstring · uuidqueryoptional

Everything this one person has had from the store.

rule_keystringqueryoptional

One rule's own history ('near_reward', 'lapsed_30', 'campaign').

sincestringqueryoptional

ISO timestamp for the summary window. Defaults to 30 days back.

Response, 200

automatic_marketing_enabledbooleanrequired

Is this store sending on its own, or still working a queue by hand? Read from the switch itself, never inferred from the rows.

summaryobjectrequired
7 child fields
sincestringrequired

Start of the window these figures cover.

sentnumberrequired

Messages that actually left, in the window.

automaticnumberrequired

How many of those the system sent by itself.

peopleReachednumberrequired

Distinct PEOPLE, not messages.

peopleReturnednumberrequired

Distinct people who did something afterwards.

valuePencenumberrequired

Real money taken, in pence.

bouncednumberrequired

How many bounced. Zero is a good number and worth printing.

sendsarray of objectrequired
17 child fields
idstringrequired
customerIdstring, nullablerequired

Who it went to. Null only for a send with no single recipient.

customerNamestring, nullablerequired

Resolved at read time through the reportable-customers guard. Null when the person has since been deleted: the send stays in the merchant history, the name does not come back.

sourceenumrequired
momentjourneycampaign
ruleKeystringrequired

Stable machine name of the rule: a moment slug, a journey_type, or 'campaign'.

ruleNamestring, nullablerequired

What to print. Frozen at send time.

channelenumrequired
appemailpush
automaticbooleanrequired

True when the system decided and sent it; false when a person at the store did.

subjectstring, nullablerequired
bodyPreviewstring, nullablerequired

Plain text of what was actually sent, capped at 500 characters and frozen. Null on rows backfilled from before the ledger existed, where the stored body may have been edited since.

sentAtstringrequired
openedAtstring, nullablerequired
clickedAtstring, nullablerequired
bouncedAtstring, nullablerequired

It left and came back. Email only.

resultKindstring, nullablerequired

What they did afterwards, inside the attribution window: stamp, order, checkin, redeem, returned.

resultAtstring, nullablerequired
resultValuePencenumber, nullablerequired

Real money, only where a real transaction was matched.

has_morebooleanrequired
next_beforestring, nullablerequired

Cursor for the next page: pass back as `before`, together with `next_before_id`.

next_before_idstring, nullablerequired

The other half of the cursor. `sent_at` carries no uniqueness constraint and automatic sends are written concurrently in batches, so a timestamp alone would skip the second of two rows sharing an instant whenever a page boundary fell between them. Pass both.

curl -G "https://www.membber.com/api/v1/marketing/ledger" \
  -H "Authorization: Bearer $MEMBBER_TOKEN" \
  --data-urlencode "store_id=6659c139-0000-4000-8000-d0c500000066"
Response, 200
{
  "automatic_marketing_enabled": true,
  "summary": {
    "since": "<since>",
    "sent": 1,
    "automatic": 1,
    "peopleReached": 1,
    "peopleReturned": 1,
    "valuePence": 1,
    "bounced": 1
  },
  "sends": [
    {
      "id": "00000d1b-0000-4000-8000-d0c500000000",
      "customerId": "a1c10999-0000-4000-8000-d0c5000000a1",
      "customerName": "Alex Example",
      "source": "moment",
      "ruleKey": "<ruleKey>",
      "ruleName": "<ruleName>",
      "channel": "app",
      "automatic": true,
      "subject": "<subject>",
      "bodyPreview": "<bodyPreview>",
      "sentAt": "<sentAt>",
      "openedAt": "<openedAt>",
      "clickedAt": "<clickedAt>",
      "bouncedAt": "<bouncedAt>",
      "resultKind": "<resultKind>",
      "resultAt": "<resultAt>",
      "resultValuePence": 1
    }
  ],
  "has_more": true,
  "next_before": "<next_before>",
  "next_before_id": "76ca3f8f-0000-4000-8000-d0c500000076"
}
WhatsApp
Book a Call
Start Free