Add a shopper and record their consent
Create the shopper identity the portals use, keep its details current, record the consent they actually gave and the withdrawal the moment it comes — consent records are legal facts.
Customers · a play in 4 steps.
The steps
- Create the shopper profile. — createConsumer
- Edit the profile — the change takes effect immediately and writes a revision. — updateConsumer
- Record the consent the shopper gave — only what was actually given — and a withdrawal the moment it comes. — grantConsent, withdrawConsent
- Read the decisions as they stand — one row per shopper per purpose. — consentRecords
The calls
Every operation this use case runs, in the order it first appears, with the request and the response its reference page shows.
createConsumer
createConsumer — mutation · Create a new consumer profile — the shopper identity used by portals at your organization.
Example request
mutation ExampleCreateConsumer($input: NewConsumerInput!) {
createConsumer(input: $input) {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
email
displayName
phones
priceGroupId
tagIds
locale
displayCurrency
dateOfBirth
commsFrequency
commsFormat
commsTopics
interests
preferredLogicalFacilityId
}
}
Variables:
{
"input": {
"caption": "Blue jeans",
"email": "<the person’s email address>"
}
}
Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.
Example response
{
"data": {
"createConsumer": {
"id": "01900000-0000-7000-8000-37386ae00000",
"sysId": "CN-EXMP-0000-000F",
"type": "Consumer",
"caption": "Blue jeans",
"status": "active",
"parentId": "01900000-0000-7000-8000-065235280000",
"rootId": "01900000-0000-7000-8000-a093dd800000",
"createdAt": "2027-01-31T00:00:00.000Z",
"updatedAt": "2027-01-31T00:00:00.000Z",
"revisionNum": 1,
"revision": "01900000-0000-7000-8000-b7960e180000",
"email": "<the person’s email address>",
"displayName": "Blue jeans",
"phones": [
"<phones>"
],
"priceGroupId": "01900000-0000-7000-8000-c7ffbf680000",
"tagIds": [
"01900000-0000-7000-8000-decd62770000"
],
"locale": "en-CA",
"displayCurrency": "<display currency>",
"dateOfBirth": "<date of birth>",
"commsFrequency": "<comms frequency>",
"commsFormat": "<comms format>",
"commsTopics": [
"<comms topics>"
],
"interests": [
"<interests>"
],
"preferredLogicalFacilityId": "01900000-0000-7000-8000-23734f810000"
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": {
"name": "genesis",
"number": 0
},
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}
updateConsumer
updateConsumer — mutation · Edit a consumer profile — the shopper identity used by portals — change its details.
Example request
mutation ExampleUpdateConsumer($id: ID!, $revision: ID!, $input: EditConsumerInput!) {
updateConsumer(id: $id, revision: $revision, input: $input) {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
email
displayName
phones
priceGroupId
tagIds
locale
displayCurrency
dateOfBirth
commsFrequency
commsFormat
commsTopics
interests
preferredLogicalFacilityId
}
}
Variables:
{
"id": "01900000-0000-7000-8000-37386ae00000",
"revision": "01900000-0000-7000-8000-b7960e180000",
"input": {
"caption": "Blue jeans"
}
}
Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.
Example response
{
"data": {
"updateConsumer": {
"id": "01900000-0000-7000-8000-37386ae00000",
"sysId": "CN-EXMP-0000-000F",
"type": "Consumer",
"caption": "Blue jeans",
"status": "active",
"parentId": "01900000-0000-7000-8000-065235280000",
"rootId": "01900000-0000-7000-8000-a093dd800000",
"createdAt": "2027-01-31T00:00:00.000Z",
"updatedAt": "2027-01-31T00:00:00.000Z",
"revisionNum": 1,
"revision": "01900000-0000-7000-8000-b7960e180000",
"email": "<the person’s email address>",
"displayName": "Blue jeans",
"phones": [
"<phones>"
],
"priceGroupId": "01900000-0000-7000-8000-c7ffbf680000",
"tagIds": [
"01900000-0000-7000-8000-decd62770000"
],
"locale": "en-CA",
"displayCurrency": "<display currency>",
"dateOfBirth": "<date of birth>",
"commsFrequency": "<comms frequency>",
"commsFormat": "<comms format>",
"commsTopics": [
"<comms topics>"
],
"interests": [
"<interests>"
],
"preferredLogicalFacilityId": "01900000-0000-7000-8000-23734f810000"
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": {
"name": "genesis",
"number": 0
},
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}
grantConsent
grantConsent — mutation · Record a customer’s consent (marketing, data use) as staff, on their word.
Example request
mutation ExampleGrantConsent($input: ConsentDecisionInput!) {
grantConsent(input: $input) {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
purposeId
policyVersion
captureSurface
captureLocale
}
}
Variables:
{
"input": {
"consumerId": "01900000-0000-7000-8000-6e8c92ec0000",
"purposeId": "01900000-0000-7000-8000-3e56c4740000",
"policyVersion": "<policy version>",
"captureSurface": "<capture surface>",
"captureLocale": "<capture locale>"
}
}
Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.
Example response
{
"data": {
"grantConsent": {
"id": "01900000-0000-7000-8000-37386ae00000",
"sysId": "CD-EXMP-0000-000F",
"type": "ConsentRecord",
"caption": "Blue jeans",
"status": "granted",
"parentId": "01900000-0000-7000-8000-065235280000",
"rootId": "01900000-0000-7000-8000-a093dd800000",
"createdAt": "2027-01-31T00:00:00.000Z",
"updatedAt": "2027-01-31T00:00:00.000Z",
"revisionNum": 1,
"revision": "01900000-0000-7000-8000-b7960e180000",
"purposeId": "01900000-0000-7000-8000-3e56c4740000",
"policyVersion": "<policy version>",
"captureSurface": "<capture surface>",
"captureLocale": "<capture locale>"
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": {
"name": "genesis",
"number": 0
},
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}
withdrawConsent
withdrawConsent — mutation · Record a customer withdrawing a consent, as staff.
Example request
mutation ExampleWithdrawConsent($input: ConsentDecisionInput!) {
withdrawConsent(input: $input) {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
purposeId
policyVersion
captureSurface
captureLocale
}
}
Variables:
{
"input": {
"consumerId": "01900000-0000-7000-8000-6e8c92ec0000",
"purposeId": "01900000-0000-7000-8000-3e56c4740000",
"policyVersion": "<policy version>",
"captureSurface": "<capture surface>",
"captureLocale": "<capture locale>"
}
}
Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.
Example response
{
"data": {
"withdrawConsent": {
"id": "01900000-0000-7000-8000-37386ae00000",
"sysId": "CD-EXMP-0000-000F",
"type": "ConsentRecord",
"caption": "Blue jeans",
"status": "granted",
"parentId": "01900000-0000-7000-8000-065235280000",
"rootId": "01900000-0000-7000-8000-a093dd800000",
"createdAt": "2027-01-31T00:00:00.000Z",
"updatedAt": "2027-01-31T00:00:00.000Z",
"revisionNum": 1,
"revision": "01900000-0000-7000-8000-b7960e180000",
"purposeId": "01900000-0000-7000-8000-3e56c4740000",
"policyVersion": "<policy version>",
"captureSurface": "<capture surface>",
"captureLocale": "<capture locale>"
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": {
"name": "genesis",
"number": 0
},
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}
consentRecords
consentRecords — query · The consent record list — each entry is one customer’s decision on one consent purpose — a legal fact.
Example request
query ExampleConsentRecords($limit: Int) {
consentRecords(limit: $limit) {
items {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
purposeId
policyVersion
captureSurface
captureLocale
}
nextToken
}
}
Variables:
{
"limit": 1
}
Example response
{
"data": {
"consentRecords": {
"items": [
{
"id": "01900000-0000-7000-8000-37386ae00000",
"sysId": "CD-EXMP-0000-000F",
"type": "ConsentRecord",
"caption": "Blue jeans",
"status": "granted",
"parentId": "01900000-0000-7000-8000-065235280000",
"rootId": "01900000-0000-7000-8000-a093dd800000",
"createdAt": "2027-01-31T00:00:00.000Z",
"updatedAt": "2027-01-31T00:00:00.000Z",
"revisionNum": 1,
"revision": "01900000-0000-7000-8000-b7960e180000",
"purposeId": "01900000-0000-7000-8000-3e56c4740000",
"policyVersion": "<policy version>",
"captureSurface": "<capture surface>",
"captureLocale": "<capture locale>"
}
],
"nextToken": "<the cursor from the previous page>"
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": null,
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}