Read Mailchimp interest choices

Build grouped interest choices for a preference form from the Mailchimp audience configured for the selected publication. This read does not load a reader's preferences, change subscriptions or configure the provider.

TaskOperationResult
Build grouped interest choicesGET /api/v1/admin/integrations/mailchimp/categoriesCategory groups with provider interest IDs and labels

Before you start

A resource is the publication selected by its public key. Use an existing active staff token authorized for that publication with a readonly, manager, support, admin or partner role; root is also permitted. Service-account credentials are not supported. Keep credentials in trusted server code. See credential transport.

InputLocation / typeRequirement and meaning
resourceRequired header, stringPublication public key, supplied as RESOURCE_KEY.
tokenRequired header, stringExisting eligible staff token, supplied as ADMIN_TOKEN.

The publication must already have a working Mailchimp key and audience/list configuration. Resolved settings can include partner overrides; selecting a publication does not establish an exclusive provider account or audience. This read does not provision the configuration. Provider keys/list IDs and reader IDs are not request inputs.

Set WALLKIT_API_BASE to the API scheme and host only, plus RESOURCE_KEY and ADMIN_TOKEN. Examples use fictional provider IDs/labels, cURL, Node.js18+ built-in fetch in an ES module (.mjs) and Python3 urllib. All examples are synthetic and unexecuted; see sample runtimes.

Build grouped interest choices

GET /api/v1/admin/integrations/mailchimp/categories

Read categories and their interest choices for the configured audience. No reader ID, request body or action-specific query input is needed. The configured category-name setting does not filter this result.

Result

HTTP 200 returns root groups. Category retrieval asks for up to 50 categories, and each category's interest request asks for up to 50 interests. There is no next-page loop or pagination input on this operation. Categories with no returned interests are omitted, so the result can be empty or partial.

FieldType / presenceMeaning
groupsArray; may be emptyReturned category groups with interest choices.
groups[].idProvider category identifier; no explicit type conversionCategory key, not a Wallkit resource or reader ID.
groups[].titleProvider labelCategory display title.
groups[].interestsNonempty arrayChoices returned for this category.
groups[].interests[].idProvider interest identifier; no explicit type conversionKey used to join a reader's interest flags.
groups[].interests[].titleProvider labelInterest display name, copied without normalization. Render it as text.

No stable ordering or complete audience catalog is guaranteed. A 200 result is not a provider-health check. This action does not change reader preferences.

Example: Load choices for a preference form

Send the same header-only request in each language. The synthetic response excerpt contains one category with two choices.

curl --silent --show-error \
  "${WALLKIT_API_BASE}/api/v1/admin/integrations/mailchimp/categories" \
  -H "resource: ${RESOURCE_KEY}" \
  -H "token: ${ADMIN_TOKEN}"
const response = await fetch(
  new URL('/api/v1/admin/integrations/mailchimp/categories', process.env.WALLKIT_API_BASE),
  { headers: { resource: process.env.RESOURCE_KEY, token: process.env.ADMIN_TOKEN } }
);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
console.log(JSON.stringify(data, null, 2));
import json
import os
from urllib.request import Request, urlopen

url = os.environ['WALLKIT_API_BASE'].rstrip('/') + '/api/v1/admin/integrations/mailchimp/categories'
request = Request(url, headers={
    'resource': os.environ['RESOURCE_KEY'],
    'token': os.environ['ADMIN_TOKEN'],
})
with urlopen(request) as response:
    data = json.load(response)
print(json.dumps(data, indent=2))
{
  "groups": [
    {
      "id": "d4e5f6a7b8",
      "title": "Topics",
      "interests": [
        {"id": "b2c3d4e5f6", "title": "Technology"},
        {"id": "c3d4e5f6a7", "title": "Product updates"}
      ]
    }
  ]
}

Use the two interest IDs as choice keys. Category and interest titles are display labels, not identifiers or instructions to interpret as HTML.

If no groups are returned

{"groups": []}

No usable groups were selected from the returned provider data. This can reflect empty or missing collections; it does not prove that the audience has no interests or that provider retrieval succeeded. Do not erase saved reader choices based on this result alone.

Recovery and next task

HTTPAPI code / shapeCauseNext action
500integration_errorNo configured Mailchimp key; description is Mailchimp integration not configurated.Ask the integration administrator to check the selected publication's resolved key/list configuration.
409integration_errorA caught integration exception; description carries its message.Check configuration/provider availability with the administrator; keep diagnostic details in trusted handling.
200groups: [] or partial groupsExpected provider collections were empty/missing or only some choices were returned.Keep the form's unavailable state distinct from a confirmed empty catalog; do not clear existing preferences.

Shared caller failures are below; upstream failures are not guaranteed to use one uniform status. Use the returned interest IDs as your form's choice keys and render the labels as text. Keep the form unavailable when the catalog cannot be established; this read does not supply a reader's saved preferences.

Shared recovery

Errors use the shared error shape, including error, error_description and req_guid; examples above may show excerpts. Handle status separately from returned business data. These tables cover known error cases; upstream failures can behave differently.

HTTPAPI code / shapeCauseNext action
404resource_not_existsThe publication public key did not resolve.Check RESOURCE_KEY and the intended publication.
401auth_failed, auth_access_fail, token_compromised or token_expiredMissing/ineligible caller, suspended/locked caller context, or invalidated/expired session.Confirm the existing caller and token with the administrator through the established authentication flow.
401 or 403accessCaller lacks the required access.Confirm the listed staff roles and selected publication.
409initialize_failedShared request initialization failed.Preserve the request reference and report the failure to the administrator; do not interpret it as an empty provider result.

Full diagram

Use the arrow keys to scroll. Escape closes this view.

Search documentation

Enter at least 2 characters.

    ↑ ↓ move through results · Enter opens · Escape closes