Consent and do-not-contact
Two ways of recording a no, three of recording a yes, and why they are not each other's opposite.
Updated
On this page
Three separate flags on a contact. The distinction between them is the whole point.
| Field | Records | Set by |
|---|---|---|
do_not_call | A no, for calls | The do_not_call action mid-call, or the API |
do_not_message | A no, for texts | An inbound STOP, a provider receipt, or the API |
marketing_consent_call / _message / _email | A yes, per channel | The record_marketing_consent action, and nothing else |
The two "no" flags are not one flag
Somebody who texts STOP has not said "never ring me". Collapsing the two would either ignore an opt-out or throw away a permission you legitimately have. They are separate in law and separate here.
Both are plain booleans, not a status, so they survive every other state change. Archiving a contact must never quietly make them dialable again. Each is stamped with when it was set, because "when did they ask us to stop" is the first question anybody asks when one is disputed.
"Yes" is not the absence of "no"
The default for all of these is silence. A contact who has never been asked is neither opted out nor opted in. Storing consent as "not do_not_call" would turn every number somebody typed into a form into a marketing permission.
Consent is recorded per channel, because consent is per
channel in law, and because that is the mistake this design exists to make
impossible. An export saying somebody wanted marketing email is not a
permission to ring them, and a single opted_in boolean is how those
two become one.
Consent carries its evidence
Two more fields come with it:
marketing_consent_source, how it was obtained, ascall:cal__...orform:frs__.... Consent with no provenance is an assertion. The question anybody asks about it a year later is "who says so", and a boolean cannot answer that.marketing_consent_evidence, what was actually said, in their words. The recording is the primary evidence and lives on the call. This is the excerpt, kept so the question can be answered without going and finding the audio.
Consent is read-only over the API
All six consent fields are read-only on the contacts API: the three booleans, the timestamp, the source and the evidence. You can read them. You cannot set them.
The only writer is the tool that heard it, which is the
record_marketing_consent action, during a call, with a quote. That
constraint is deliberate rather than an oversight. Consent you can switch on
with a PATCH is consent with no evidence behind it.
The two opt-out flags are writable, along with
do_not_call_reason, because somebody phoning the office to be taken
off a list has to be able to be taken off a list. Their timestamps are not
writable; they get stamped for you.
cURL
curl -X PATCH https://api.voxcore.net/api/v1/orgs/<org_id>/contacts/<contact_id>/ \
-H "Authorization: Bearer vox_sk_live_..." \
-H "Content-Type: application/json" \
-d '{"do_not_call": true, "do_not_call_reason": "asked on the phone"}'Python
import os, httpx
BASE, ORG = "https://api.voxcore.net", os.environ["VOXCORE_ORG"]
AUTH = {"Authorization": f"Bearer {os.environ['VOXCORE_API_KEY']}"}
contact = httpx.patch(
f"{BASE}/api/v1/orgs/{ORG}/contacts/{contact_id}/",
headers=AUTH,
json={"do_not_call": True, "do_not_call_reason": "asked on the phone"},
).json()Python (voxcore)
from voxcore import Voxcore
vox = Voxcore()
contact = vox.contacts.update(
contact_id,
do_not_call=True,
do_not_call_reason="asked on the phone",
)That PATCH works from the dashboard. It does not work with an
API key, subject to the scopes on it, as described in
Authentication. Until that is
fixed, an opt-out arriving by phone has to be recorded by a person or by the
mid-call action, not by a script holding a key.
There is no email opt-out flag
Nothing on a contact records one. do_not_message is the STOP an
inbound text sets, and reusing it for email would be inventing a consent nobody
gave. Same reason a batch can only be resolved for call or
message, never for email.