Skip to content

Powered by Grav CMS + Helios Theme

Newsletter subscribers (add-on)

The people on the mailing list, their consent and memberships, and the link to a KahunaCart customer.

The people on the mailing list. An email address is never echoed back to a caller who did not already have it: a read answers what it was asked for and nothing more. See Subscribers, lists and tags.

List subscribers

GET /api/v1/kahunacart/newsletters/subscribers Permission kahunacart.newsletters.view

Who is on the mailing list, with the lists and tags each person carries, how they joined, when they agreed and what state they are in. Search matches anywhere in an address or a name. Give campaign_id and campaign_received together to narrow the table to the people one campaign reached, or to the people it did not, which is the list a follow-up goes to. The status counts come back for the whole table rather than for the page.

Parameters

Name Type Description
q optional string Part of an email address or a name
status optional string
One of: pending, subscribed, unsubscribed, bounced, complained
source optional string How they joined
One of: form, checkout, account, import, api, admin
list optional integer Only people holding a membership on this list
list_status optional string Where they stand on that list: waiting to confirm, subscribed, or left. Needs list beside it. The answer's list_counts count the list's people by where they stand on it
One of: pending, subscribed, unsubscribed
tag optional integer Only people carrying this tag
campaign_id optional integer The campaign to ask about. Needs campaign_received beside it
campaign_received optional string Whether that campaign was sent to them. "Sent" is a send row the mail actually left on, so a pending, failed or skipped row counts as not sent. Needs campaign_id beside it
One of: yes, no
sort optional string Sort by this column instead of newest first
One of: email, status, source, joined
dir optional string Which way sort runs. Without it, dates and counts run highest first and words A to Z
One of: asc, desc
page optional integer At least 1.
per_page optional integer At least 1, at most 200.

Get one subscriber

GET /api/v1/kahunacart/newsletters/subscribers/{id} Permission kahunacart.newsletters.view

One person with the whole record behind them: the consent — when they agreed, from what address, and whether the store still holds the sentence they were shown — every list they hold a membership on and its state, their tags, the import they came in with if they came in with one, the customer record they are linked to if there is one, whether the store has been told never to mail the address, and every campaign they were part of with what happened to it. This is the answer to a complaint.

Parameters

Name Type Description
id required integer Subscriber id

Export one subscriber's data

GET /api/v1/kahunacart/newsletters/subscribers/{id}/export Permission kahunacart.newsletters.manage

Everything held about one person, as one JSON document, for answering somebody who asks what is kept about them: their profile, every list membership with its status and dates, their tags, the full consent history (each signup, confirmation, admin add or invite, import, unsubscribe and return, with the address and browser for the changes they made themselves and the note for an admin's), every message they were sent with when it was opened and each link they pressed, what the mail provider reported about them (deliveries, bounces, complaints), their automation walks, any suppression on their address, the import runs that brought them in, and any records the site adds of its own. It holds the same records deleting the person removes. Left out: the person's signing secret and address hash, and other people, including which admin made a change. Needs the same permission as the CSV export.

Parameters

Name Type Description
id required integer Subscriber id

Add a subscriber

POST /api/v1/kahunacart/newsletters/subscribers Permission kahunacart.newsletters.manage

Add one person to a list by address, as source "admin". Say how with mode: invite sends the ordinary confirmation email and leaves them waiting on the list until they press it; subscribed adds them on your word and needs a note saying where they agreed, which goes into their consent history. Without a mode the list's own confirmation setting decides. Somebody already known keeps their standing on every other list. A suppressed, bounced or complained address is refused with a sentence saying why, and so is anybody who left that list, or every list, themselves (resubscribe_subscriber with a note is the way back for somebody who asked). The answer's outcome says added, invited, already_on or already_invited. For a list from another tool, use the CSV importer instead: it checks suppressions, counts what it did and keeps the file name as evidence.

Parameters

Name Type Description
email required string
name optional string or null
list_id optional integer Which list to add them to. Omitted uses the default list.
tags optional array of string Tag codes. Ones that do not exist yet are created.
language optional string or null Two-letter language code
mode optional string invite them to confirm, or add them as already agreed. Omitted follows the list.
One of: invite, subscribed
note optional string With mode subscribed: where they agreed. Required there.

Edit a subscriber

PATCH /api/v1/kahunacart/newsletters/subscribers/{id} Permission kahunacart.newsletters.manage

Change somebody's name, language, lists or tags. The email address is not editable and the attempt is refused: it is the key every consent record, suppression, send row and signed link is hung off, and changing it would be creating a second person and calling it an edit. Only lists somebody already holds a membership on are moved, so this cannot put anybody on a topic they were never offered, and a list they left themselves stays left (resubscribe_subscriber, with a note, is for somebody who asked).

Parameters

Name Type Description
id required integer Subscriber id
name optional string or null
language optional string or null
lists optional array of integer The list ids that should be on. Everything else they hold is set to unsubscribed.
tags optional array of string The tag codes they should carry, exactly. Anything not named is removed.

Unsubscribe somebody

POST /api/v1/kahunacart/newsletters/subscribers/{id}/unsubscribe Permission kahunacart.newsletters.manage

Take one person off every list, recorded as done by the store rather than by them. Use it when somebody has asked by email or on the phone. They can sign up again themselves whenever they like; nothing here suppresses the address.

Parameters

Name Type Description
id required integer Subscriber id

Put somebody back on the list

POST /api/v1/kahunacart/newsletters/subscribers/{id}/resubscribe Permission kahunacart.newsletters.manage

Undo an unsubscribe, for somebody who has asked you to. Refused for an address that bounced or complained, and for one on the suppression list, because those are facts about mail the store already sent and no button in an admin overturns one — the suppression has to be removed first, on its own screen, as its own decision. This is the one way back for somebody who unsubscribed themselves, so it needs a note saying how they asked, which goes into their consent history. Name a list to put them back on that one; omit it and every list they were ever on comes back. Their other lists are left as they are.

Parameters

Name Type Description
id required integer Subscriber id
list_id optional integer Just this list. Omitted means every list they were ever on.
note optional string How they asked to come back (the email, the call, the date). Required.

Confirm somebody by hand

POST /api/v1/kahunacart/newsletters/subscribers/{id}/confirm Permission kahunacart.newsletters.manage

Move a person who is waiting to confirm onto their lists, for the one whose confirmation email went to spam or never arrived and who has since asked, in writing, to be on the list. Only a pending person moves: one already on the list has nothing to confirm, one who left is a resubscribe with its own warning, and a bounced, complained or suppressed address is refused for the same reasons resubscribe refuses it. The memberships it writes are recorded as confirmed by the store, not by the person.

Parameters

Name Type Description
id required integer Subscriber id

Delete a subscriber

DELETE /api/v1/kahunacart/newsletters/subscribers/{id} Permission kahunacart.newsletters.manage

Remove one person from the mailing list entirely — their memberships, their tags, every send they were part of and every click they made. The suppression list is not touched, on purpose: an address that bounced last month is still an address this store must not mail, and forgetting why would be worse than keeping it. An erasure request is a different thing and arrives through the store's own customer erasure.

Parameters

Name Type Description
id required integer Subscriber id

Change many subscribers at once

POST /api/v1/kahunacart/newsletters/subscribers/bulk Permission kahunacart.newsletters.manage

One action over many people: add them to a list, take them off one, add or remove a tag, unsubscribe them from everything, or delete them. Say who with exactly one of ids (up to 500), filter (the same filters list_subscribers takes, walked 500 at a time: send the answer's next back as after until finished is true) or addresses (pasted email addresses, optionally with names, for add_to_list only; new ones become subscribers). Adding to a list asks how: mode invite sends the confirmation email and leaves them pending on the list until they press it, mode subscribed adds them on your word and needs a note saying where they agreed, which goes into their consent history. Without a mode the list's own confirmation setting decides. Suppressed, bounced and complained addresses are never added, and nobody is put back on a list they left themselves. The answer counts what was done and, by reason, who was skipped. Delete removes each person the way delete_subscriber does and leaves the suppression list alone. Unsubscribe and delete over a filter need at least one filter set, or all: true to mean everybody.

Parameters

Name Type Description
action required string
One of: add_to_list, remove_from_list, add_tag, remove_tag, unsubscribe, delete
ids optional array of integer Subscriber ids, at most 500 in one call
filter optional object The list_subscribers filters: q, status, source, list, list_status, tag, campaign_id, campaign_received, test
all optional boolean With filter and unsubscribe or delete: true to mean everybody, when no filter is set
after optional integer With filter: the next value from the previous answer
max_id optional integer With filter: the max_id from the previous answer, so people who start matching mid-walk are left out
addresses optional string For add_to_list: addresses separated by new lines or commas, each optionally with a name
list_id optional integer For add_to_list and remove_from_list
mode optional string For add_to_list: invite them to confirm, or add them as already agreed
One of: invite, subscribed
note optional string For add_to_list with mode subscribed: where they agreed. Required there.
tag optional string For add_tag: the tag, made if it is new
tag_id optional integer For remove_tag

What the mailing list knows about a customer

GET /api/v1/kahunacart/newsletters/customers/{id}/subscriber Permission kahunacart.newsletters.view

Given a KahunaCart customer id, the subscriber record linked to it: their address and status, whether the store has been told never to mail them, every list they are on with how they got there, and the last campaign they were actually sent — with the date, and whether they opened it, clicked in it or it bounced. A customer with no subscriber answers with a null subscriber and empty lists rather than a 404, because most customers on most stores have never been asked. Use it to answer "is this customer on the newsletter" without paging the whole subscriber list.

Parameters

Name Type Description
id required integer Customer id, not subscriber id

Export subscribers as CSV

GET /api/v1/kahunacart/newsletters/subscribers/export Permission kahunacart.newsletters.manage

The subscriber list as a CSV file, filtered exactly as the admin table is. No tool: it is every address the store holds, as a document to open in a spreadsheet.