Customer Contact Preferences

The Customer Contact Preferences API allows you to access the permissions the user provided to be contacted on.

Customer records may contain email, phone numbers, etc, however they may have only given permission for documentation to be provided over email, and no marketing permissions. This API should be used in conjunction with the customer details API to determine what permissions have been given.


The Customer Contact Preferences Resource

Properties

  • Name
    documentation
    Required
    Type
    object
    Description
    • Name
      email
      Required
      Type
      boolean
      Description

      Whether the customer has given permission for the email to be used for receiving documentation.

    • Name
      mobile
      Required
      Type
      boolean
      Description

      Whether the customer has given permission for their mobile number to be used for receiving documentation.

    • Name
      phone
      Required
      Type
      boolean
      Description

      Whether the customer has given permission for their phone number to be used for receiving documentation.

    • Name
      post
      Required
      Type
      boolean
      Description

      Whether the customer has given permission for their postal address to be used for receiving documentation.

    • Name
      print
      Required
      Type
      boolean
      Description

      Whether the customer has given permission for documentation to be printed for delivery.

  • Name
    marketing
    Required
    Type
    object
    Description
    • Name
      email
      Required
      Type
      boolean
      Description

      Whether the customer has given permission for the email to be used for receiving marketing material.

    • Name
      mobile
      Required
      Type
      boolean
      Description

      Whether the customer has given permission for their mobile number to be used for receiving marketing material.

    • Name
      phone
      Required
      Type
      boolean
      Description

      Whether the customer has given permission for their phone number to be used for receiving marketing material.

    • Name
      post
      Required
      Type
      boolean
      Description

      Whether the customer has given permission for their postal address to be used for receiving marketing material.

    • Name
      print
      Required
      Type
      boolean
      Description

      Whether the customer has given permission for personal marketing material to be printed for delivery.

Customer Company Resource

{
  "documentation": {
    "email": true,
    "mobile": false,
    "phone": false,
    "post": true,
    "print": true
  },
  "marketing": {
    "email": false,
    "mobile": false,
    "phone": false,
    "post": false,
    "print": false
  }
}

GET/v2/customers/:customer_id/preferences

Retrieve Contact Preferences

Will retrieve the contact preferences recorded for the customer.

URL Parameters

  • Name
    customer_id
    Required
    required
    Type
    integer
    Description

    ID of the customer to retrieve the contact preferences for

Error Codes

Status Description
404 The requested customer could not be found.

Request

GET
/v2/customers/:customer_id/preferences
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;

private ApexV3SdkInterface $sdk;

$response = $this->sdk
  ->v2(new Machine())
  ->customer(1)
  ->contactPreferences()
  ->get();

Response

{
  "data": {
    "documentation": {
      "email": true,
      "mobile": false,
      "phone": false,
      "post": true,
      "print": true
    },
    "marketing": {
      "email": false,
      "mobile": false,
      "phone": false,
      "post": false,
      "print": false
    }
  }
}

PUT/v2/customers/:customer_id/preferences

Update Contact Preferences

Will attempt to update the customers contact preferences. All existing preferences will be removed. The contact methods provided, and intents must be a definitive list of approved preferences.

URL Parameters

  • Name
    customer_id
    Required
    required
    Type
    integer
    Description

    ID of the customer to update the contact preferences of

Payload

  • Name
    documentation
    Required
    Type
    array<string>
    Description

    An array of contact methods allowed to be used for delivering documentation. Must be one of email, mobile, phone, post or print.

  • Name
    marketing
    Required
    Type
    array<string>
    Description

    An array of contact methods allowed to be used for delivering marketing materials. Must be one of email, mobile, phone, post or print.

Error Codes

Status Description
404 The requested customer could not be found.
422 The data provided in the payload was invalid. See errors for more details.

Request

PUT
/v2/customers/:customer_id/preferences
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;

private ApexV3SdkInterface $sdk;

$response = $this->sdk
  ->v2(new Machine())
  ->customer(1)
  ->contactPreferences()
  ->update(
    ['email', 'post'], // Documentation
    ['print']          // Marketing
  );

Response

{
  "data": {
    "documentation": {
      "email": true,
      "mobile": false,
      "phone": false,
      "post": true,
      "print": false
    },
    "marketing": {
      "email": false,
      "mobile": false,
      "phone": false,
      "post": false,
      "print": true
    }
  }
}