openemail audiences
이 네임스페이스의 모든 명령과 그 인수, 플래그, 예시.
명령
Named lists of contacts. Every contact is in the default audience, and you make the rest.
여기 있는 모든 명령은 --json, --profile, --dry-run 같은 전역 플래그도 받습니다. 전역 플래그 보기
openemail audiences list
List one page of the workspace audiences
ls사용법
openemail audiences list [flags]
Returns one page of the audiences in the workspace, with the default audience first and the rest newest first. Paging is keyset: --limit takes 1 to 100 and defaults to 25, and nextCursor goes back as --cursor while hasMore is true, so every audience is reachable.
builtin tells the default audience apart from the ones you made. It is default on exactly one row per workspace, the audience that holds every contact, and null on everything else. Branch on builtin rather than on the name, which anybody can change.
contactCount is counted at the moment of the read, so two reads either side of a contacts.create disagree by one.
Add --all to walk every page: a table on a terminal, one JSON object per line when piped or with --ndjson, and one { items, hasMore, nextCursor } document with --json. --max <n> stops after that many items.
플래그
--limit <n>Rows per page, a whole number from 1 to 100. The server defaults to 25.
기본값25--cursor <value>The
nextCursorfrom the previous page, an audience id. One that names no audience in the workspace is a 400invalid_cursor.--allFetch every page and stream the items as they arrive.
--max <n>Stop after this many items. Implies
--all.--ndjsonPrint every item as one JSON object per line. Implies
--all
예시
openemail audiences listopenemail audiences list --all --max 100openemail audiences list --all > audiences.ndjson다른 사용처
openemail audiences growth
Read how audiences grew over a time window
사용법
openemail audiences growth [flags]
Returns the numbers behind the growth chart on the Audiences page in one request. For each audience it reports total, the contacts in it now, before, how many of those joined before the window, added, how many joined inside it, subscribed, how many of them are still subscribed, unsubscribed, how many unsubscribed inside the window through a broadcast link, and buckets, when they joined and unsubscribed, cut to grain. totals sums the audiences read.
An audience records the date each contact joined it and never the date one left. A series therefore counts the contacts still in the list today by the date they joined, and it never falls: a contact who joined inside the window and was removed since is not in it at all. Read it as the growth of the list as it stands, not as a history of every change.
totals.contacts counts each person once, however many of the audiences they are in. totals.memberships adds the lists up, and the default audience holds every contact, so a person in two other audiences counts three times there. totals.subscribed counts each person still subscribed to at least one of the audiences read, which is who a broadcast to them would reach, and totals.unsubscribed adds up the unsubscribes inside the window. totals.busiest is the bucket with the most joins, or null.
buckets is sparse and oldest first: a bucket in which nobody joined or unsubscribed has no entry, so a chart must fill the gaps. grain sets the bucket width and the key shape, YYYY-MM-DD, YYYY-MM-DDTHH or YYYY-MM-DDTHH:MM, and --offset-minutes shifts the boundaries so days break where the reader's day does. The window starts at the beginning of its oldest bucket, reported as since, and ends now, reported as until.
플래그
--audience-ids <a,b>반복 가능Up to 50 audience ids to read, sent comma separated. Leave it out, or pass an empty array, to read every audience in the workspace, the default one included. An id that is not an audience of this workspace is a 404
audience_not_foundon--audience-ids, and more than 50 is a 422.--days <n>Window length in days, from 1 to 1095, defaulting to 30.
기본값30--minutes <n>Window length in minutes, from 1 to 1576800. Takes precedence over
days, and only useful below a day with a finergrain.--grain <value>Bucket width:
minute,hourorday, defaulting today.기본값"day"--offset-minutes <n>Minutes east of UTC to cut the buckets in, from -840 to 840, defaulting to 0. Pass
-new Date().getTimezoneOffset()for the local zone.기본값0
예시
openemail audiences growthopenemail audiences growth --days 90 --grain dayopenemail audiences growth --json다른 사용처
openemail audiences get
Read one audience by id
showview사용법
openemail audiences get <id> [flags]
Returns a single audience in the same shape as list, with a fresh contactCount. This is the cheap way to watch a count move without pulling the contacts behind it.
The id is the one from list or create, such as aud_9f2c4b7e1a0d63d84c5f2e7b. An id from another workspace is a 404 rather than a 403, since the API never tells you that something exists somewhere you cannot see.
인수
<id>필수Audience id such as
aud_9f2c4b7e1a0d63d84c5f2e7b.
예시
openemail audiences get aud_9f2c4b7e1a0d63d84c5f2e7bopenemail audiences get aud_9f2c4b7e1a0d63d84c5f2e7b --json다른 사용처
openemail audiences create
Create an audience
newadd사용법
openemail audiences create --name <value> [flags] openemail audiences create --data <json|@file|-> [flags]
Makes a new, empty audience in the workspace and returns it with its id. name is trimmed and must then be 1 to 120 characters. description is optional free text for whoever reads the list later.
The audience comes back with builtin null and contactCount zero. Only the default audience carries a builtin, and it cannot be made or copied here.
Names are not checked for duplicates, so two calls with the same name make two audiences. Fill it with audiences.addContact, one contact at a time, and the contacts must already be in the book.
플래그
--name <value>Display name, trimmed, 1 to 120 characters. Not unique. Required, here or in
--data.--description <value>What the audience is for. Leave it out to create the audience without one.
--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
예시
openemail audiences create --name 'Product updates'openemail audiences create --name 'Product updates' --description 'Customers who asked to hear about releases'openemail audiences create --data @audience.json다른 사용처
openemail audiences update
Rename an audience or change its description
edit사용법
openemail audiences update <id> [flags]
Changes the fields you send and leaves the rest alone. A key you leave out keeps its stored value and an explicit null clears it, so { description: null } empties the description while {} changes nothing.
The default audience can be renamed like any other, and renaming it does not change builtin or what it holds. builtin itself cannot be set, moved or cleared from here.
The id never changes, and membership is untouched.
인수
<id>필수Audience id such as
aud_9f2c4b7e1a0d63d84c5f2e7b.
플래그
--name <value>New display name, trimmed, 1 to 120 characters.
--description <value>New description. Null clears it.
--data <json|@file|->The whole
patchas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
예시
openemail audiences update aud_9f2c4b7e1a0d63d84c5f2e7b --name 'Release notes'openemail audiences update aud_9f2c4b7e1a0d63d84c5f2e7b --name 'Release notes' --json다른 사용처
openemail audiences delete
Delete an audience and keep its contacts
rmdelremove사용법
openemail audiences delete <id> [flags]
Deletes the audience and drops every membership it held, in one transaction. The contacts themselves are not touched: they stay in the address book, in the default audience, and in any other audience they were in.
The default audience cannot be deleted. The call is refused with 409 audience_immutable on id, because it is what makes the book readable as a list. Delete the contacts instead if you mean to empty it.
There is no undo, and a new audience with the same name comes back empty.
인수
<id>필수Audience id such as
aud_9f2c4b7e1a0d63d84c5f2e7b. Not the default audience.
예시
openemail audiences delete aud_9f2c4b7e1a0d63d84c5f2e7bopenemail audiences delete aud_9f2c4b7e1a0d63d84c5f2e7b --yes다른 사용처
openemail audiences empty
Take every contact out of an audience and keep the audience
사용법
openemail audiences empty <id> [flags]
Removes every membership of the audience in one transaction and resolves with the audience as it now stands, contactCount 0, plus removed, the number of contacts taken out. The audience keeps its id, name and description, so anything that points at it still works. The contacts are not touched: each one stays in the address book, in the default audience and in every other audience it is in.
The default audience cannot be emptied. The call is refused with 409 audience_immutable on id, because that audience holds every contact for as long as it is a contact.
There is no undo. The app asks the person to confirm before it empties a list, but this call asks nothing: it needs no verification code, whether it is made with an API key or with the OAuth access token of an app the person connected. Check the id before you call it.
인수
<id>필수Audience id such as
aud_9f2c4b7e1a0d63d84c5f2e7b. Not the default audience.
예시
openemail audiences empty aud_9f2c4b7e1a0d63d84c5f2e7bopenemail audiences empty aud_9f2c4b7e1a0d63d84c5f2e7b --yes다른 사용처
openemail audiences list-contacts
List one page of the contacts in one audience
사용법
openemail audiences list-contacts <id> [flags]
Returns one page of the contacts in the audience. The rows are the contacts themselves, not membership records, so they carry email, name, source, notes, lastSeenAt, createdAt and updatedAt, plus addedAt, the date the contact joined this audience, and unsubscribedAt, when it unsubscribed from a broadcast sent to this audience, or null while it is subscribed. An unsubscribed contact stays in the audience and broadcasts to it skip it.
By default the order is the one contacts.list uses: the contacts most recently written to first, and those never written to last. sort picks another order, q searches names and addresses, source keeps only contacts saved by hand or only those recorded from the composer, and statuses keeps only the subscribed or only the unsubscribed. These are the controls on the audience page in the app.
Paging is keyset: --limit takes 1 to 200 and defaults to 50, and nextCursor goes back as --cursor while hasMore is true, so every contact in the audience is reachable however large it grows. Send the same q, source, sort and statuses with every page.
Reading the default audience here returns the whole address book.
Add --all to walk every page: a table on a terminal, one JSON object per line when piped or with --ndjson, and one { items, hasMore, nextCursor } document with --json. --max <n> stops after that many items.
인수
<id>필수Audience id such as
aud_9f2c4b7e1a0d63d84c5f2e7b.
플래그
--limit <n>Rows per page, a whole number from 1 to 200. The server defaults to 50.
기본값50--cursor <value>The
nextCursorfrom the previous page. Never build one yourself; one that names no contact in this audience is a 400invalid_cursor.--q <value>Narrows to contacts whose name or address matches, up to 200 characters. When nothing matches exactly the search allows for a typo instead.
--source <value>Narrows to contacts recorded that way:
manualfor one somebody saved,autofor one recorded by a send from the app composer.--sort <value>How the page is ordered.
last-heard-newest, the default, puts the contacts most recently written to first and those never written to last,last-heard-oldestreverses it,added-newestandadded-oldestorder byaddedAt, andnameis alphabetical without case, with a contact that has no name sorting by its address.기본값"last-heard-newest"--statuses <a,b>반복 가능Keeps only
subscribedmembers, onlyunsubscribedones, or both. Leave it out, or name both, for everyone in the audience.AUDIENCE_MEMBER_STATUSESholds the values.--allFetch every page and stream the items as they arrive.
--max <n>Stop after this many items. Implies
--all.--ndjsonPrint every item as one JSON object per line. Implies
--all
예시
openemail audiences list-contacts aud_9f2c4b7e1a0d63d84c5f2e7bopenemail audiences list-contacts aud_9f2c4b7e1a0d63d84c5f2e7b --limit 200 --sort added-newestopenemail audiences list-contacts aud_9f2c4b7e1a0d63d84c5f2e7b --all --max 100openemail audiences list-contacts aud_9f2c4b7e1a0d63d84c5f2e7b --all > audiences.ndjson다른 사용처
openemail audiences add-contact
Put a contact in an audience
사용법
openemail audiences add-contact <id> --email <value> [flags] openemail audiences add-contact <id> --data <json|@file|-> [flags]
Adds one contact to one audience and returns the membership, with the contact it points at. The address is trimmed and lower cased before the lookup, and it has to be a contact in this workspace already: an address that is not in the book is refused with 422 contact_not_found on email. Save it with contacts.create first.
There is one membership per audience and contact, so adding somebody who is already in the audience returns the membership that is there, with its original addedAt, rather than adding a second one or failing. That makes the call safe to replay, and the SDK retries it after a network failure.
Adding to the default audience is accepted and changes nothing, since every contact is already in it.
인수
<id>필수Audience id such as
aud_9f2c4b7e1a0d63d84c5f2e7b.
플래그
--email <value>The address of a contact already in the workspace book, matched case insensitively. Required, here or in
--data.--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
예시
openemail audiences add-contact aud_9f2c4b7e1a0d63d84c5f2e7b --email [email protected]openemail audiences add-contact aud_9f2c4b7e1a0d63d84c5f2e7b --data @audience.json다른 사용처
openemail audiences remove-contact
Take a contact out of an audience
사용법
openemail audiences remove-contact <id> <email> [flags]
Drops one membership and leaves everything else alone. The contact stays in the address book, in the default audience and in every other audience it was in. The address is trimmed and lower cased, and the SDK URL encodes it for the path.
A contact that is not in this audience is a 404, so a typo cannot report a removal that never happened.
The default audience cannot be thinned. Removing a contact from it is refused with 409 audience_immutable, because it holds every contact by definition. Use contacts.delete when you mean the contact to go.
인수
<id>필수Audience id such as
aud_9f2c4b7e1a0d63d84c5f2e7b. Not the default audience.<email>필수The contact's address, matched case insensitively.
예시
openemail audiences remove-contact aud_9f2c4b7e1a0d63d84c5f2e7b [email protected]openemail audiences remove-contact aud_9f2c4b7e1a0d63d84c5f2e7b [email protected] --yes다른 사용처
openemail audiences add-contacts
Put up to 200 existing contacts in an audience in one call
사용법
openemail audiences add-contacts <id> --emails <a,b> [flags] openemail audiences add-contacts <id> --data <json|@file|-> [flags]
Adds many contacts to one audience in one transaction and reports what happened to each address. Each address is trimmed and lower cased, a repeat counts once, and each has to be a contact in this workspace already.
Nothing is refused for one address. An address that is not a contact is returned in missing and the others are still added, and a contact that is in the audience already is counted in unchanged and keeps its original addedAt. added counts the contacts that joined in this call.
This never creates a contact. To save new addresses and put them in the audience in the same call, use importContacts. Adding to the default audience succeeds with added: 0, since every contact is already in it.
인수
<id>필수Audience id such as
aud_9f2c4b7e1a0d63d84c5f2e7b.
플래그
--emails <a,b>반복 가능From 1 to 200 addresses of contacts already in the workspace book, matched case insensitively. An empty array or more than 200 is a 422
invalid_parameteronemails, and an empty or overlong address is the same error on that entry, such asemails.2. Required, here or in--data.--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
예시
openemail audiences add-contacts aud_9f2c4b7e1a0d63d84c5f2e7b --emails [email protected],[email protected],[email protected]openemail audiences add-contacts aud_9f2c4b7e1a0d63d84c5f2e7b --data @audience.json다른 사용처
openemail audiences remove-contacts
Take up to 200 contacts out of an audience in one call
사용법
openemail audiences remove-contacts <id> --emails <a,b> [flags] openemail audiences remove-contacts <id> --data <json|@file|-> [flags]
Removes many contacts from one audience in one transaction and reports what happened to each address. Each address is trimmed and lower cased and a repeat counts once. The contacts stay in the address book, in the default audience and in every other audience they are in.
Nothing is refused for one address, which is where this differs from removeContact. A contact that is not in this audience is returned in notInAudience, an address that is not a contact at all in missing, and the rest are still removed. removed counts the contacts taken out in this call.
The default audience cannot be thinned. The call is refused with 409 audience_immutable on id, because that audience holds every contact by definition. Use contacts.delete when you mean a contact to go.
인수
<id>필수Audience id such as
aud_9f2c4b7e1a0d63d84c5f2e7b. Not the default audience.
플래그
--emails <a,b>반복 가능From 1 to 200 addresses, matched case insensitively. An empty array or more than 200 is a 422
invalid_parameteronemails, and an empty or overlong address is the same error on that entry, such asemails.2. Required, here or in--data.--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
예시
openemail audiences remove-contacts aud_9f2c4b7e1a0d63d84c5f2e7b --emails [email protected],[email protected]openemail audiences remove-contacts aud_9f2c4b7e1a0d63d84c5f2e7b --data @audience.jsonopenemail audiences remove-contacts aud_9f2c4b7e1a0d63d84c5f2e7b --emails [email protected],[email protected] --yes다른 사용처
openemail audiences import-contacts
Import up to 500 addresses into an audience, creating contacts as needed
사용법
openemail audiences import-contacts <id> --contacts <json|@file|-> [flags] openemail audiences import-contacts <id> --data <json|@file|-> [flags]
Does what the CSV import on an audience page does, without the file. Each row is an address and an optional name, and the whole call runs in one transaction.
An address that is not a contact yet is saved as one, with source set to manual, and joins the default audience as every new contact does. An address that is a contact already is reused as it stands: its name is kept, and a name sent here only fills one that is empty. Every imported contact ends up in this audience. Importing an address whose contact was deleted brings it back.
A row whose address is not well formed is skipped rather than failing the call. It is counted in skipped and its address is returned in invalid exactly as you sent it, and every other row is still imported. Rows with the same address count once.
인수
<id>필수Audience id such as
aud_9f2c4b7e1a0d63d84c5f2e7b. The default audience is accepted and saves the contacts without putting them in any other list.
플래그
--contacts <json|@file|->From 1 to 500 rows, each
{ email, name }.emailis required, at most 320 characters, and trimmed and lower cased.nameis optional, at most 200 characters, and used for a new contact or for an existing one whose name is empty. An empty array, more than 500 rows, an emptyemailor any other key in a row is a 422. JSON shaped asArray<AudienceImportRow>, inline or from a file with @path. Required, here or in--data.--data <json|@file|->The whole
bodyas JSON, inline, from a file with @path, or - for standard input. Flags override its keys.
예시
openemail audiences import-contacts aud_9f2c4b7e1a0d63d84c5f2e7b --contacts @contacts.jsonopenemail audiences import-contacts aud_9f2c4b7e1a0d63d84c5f2e7b --data @audience.json