Native Message API - Native message

The Sourcepoint Consent API allows developers to implement a variety of consent experiences on their platform through the use of a REST API. The Sourcepoint API is a fully integrated part of the Sourcepoint platform that leverages the Campaign, Scenario, and Message definitions managed in the Sourcepoint Portal.

Using the Sourcepoint platform with the Consent API allows developers to integrate consent management capabilities into their own apps and distribution channels, while still allowing business configuration to be managed by non-technical users.

The native message API call returns a JSON response describing the vendors & their purposes attached to the campaign, the end-user's consent for a purpose for each vendor, and more. This article describes the implementation, the JSON response with examples examples of both.


POST API call - native message

This POST API call requires values for parameters to be set in the url and sent in the body of the request:

https://wrapper-api.sp-prod.net/wrapper/tcfv2/v1/gdpr/native-message?ott={TRUE/FALSE}&inApp={TRUE/FALSE}

Query params

Query param Required Description
ott Yes true if the native message is for an OTT implementation
inApp Yes true if the native message is for an app implementation

Body params

Body param Required Description
campaignEnv Optional prod|stage The type of campaign you would like to test. This defaults to prod if no value is provided
accountId Yes The account id for this native message campaign. Can be found in the Sourcepoint dashboard
propertyHref Yes The name of the property hosting the native message, as set in the Sourcepoint dashboard. Must be prefaced with https://, for example https://your.apps.name
requestUUID Optional An optional request UUID that can be sent to uniquely identify a request. We encourage you to always pass this since it helps with debugging
propertyId Optional The id of the property hosting the native message, as set in the Sourcepoint dashboard. If you decide to not pass this up, the propertyID will be resolved using the propertyHref instead
uuid Optional The user’s consent UUID. This will be empty on the first request but a value will need to be passed up on subsequent requests. More information can be found in the following example
authId Optional An optional unique identifier to link consent to the user’s profile across all devices. More information can be found in the Authentication section above
targetingParams Optional An optional stringified JSON representing targeting params you have defined in Portal. More information can be found in the following example.
meta Optional An optional string that will not be passed up in the first request but will have to be passed as is in subsequent ones. More information can be found in the following example.

Example implementation

Your organization can call the API endpoint using a serve- side script or a third-party service like Postman. You will need to provide the correct API endpoint address and values for accountId, propertyHref and (optionally) requestUUID.

JSON body With Postman PHP code
{
    "campaignEnv": "prod",
    "accountId": 22,
    "propertyHref": "https://Roku-Demo-Property",
    "requestUUID": "739f895c-ee31-425e-a0ea-b212fd782332"
}

JSON response

The response from the native message API call is a JSON string with several objects & values. The following is a description of the JSON response with their objects and values.

actions object

Field Description
type The type of action
js The javascript that is called for this action

categories object

Field Description
_id The Sourcepoint id for this category
type What type the category belongs to (IAB, Custom)
name The category name
description The category description

grants object

Field Description
_id (as field) The Sourcepoint id for this vendor
vendorGrant true if end-user has accepted all purposes for this vendor
purposeGrants object The Sourcepoint id for the purpose, true if the end-user has accepted this purpose

Other variables

Field Description
language The language setting for this message
propertyId The id of the property where the message will be displayed
gdprApplies object true if the GDPR applies for this message
euconsent object The encoded consent string for this user
consentedToAll Has the end-user consented to all purposes for every vendor?
rejectedAny Has the end-user rejected a purpose for any vendor?
dateCreated The date & time this JSON string was created
Sample - JSON response
{
   "msgJSON": {},
   "actions": [
      {
         "type": "inline",
         "js": "var cookie='consentUUID=2aef86a6-1129-4469-88ec-8ab0b93506a0; Path=/; Max-Age=31536000; expires=Thu, 24 Nov 2022 12:39:00 GMT;';\nif (false) {\n  var h = window.location && window.location.hostname;\n  if (h) {\n    var rc = (/.co.uk$/.test(h) || /.com.br$/.test(h) || /.com.au$/.test(h) || /.co.nz$/.test(h) ) ? 3 : 2;\n    var ha = h.split('.');\n    var rda = ha.slice(ha.length - rc);\n    if (rda.length > 1) {\n      var rd = rda.join('.');\n      cookie += ' Domain=' + rd + ';';\n    }\n  }\n}\ndocument.cookie = cookie;\n"
      },
      {
         "type": "inline",
         "js": ""
      }
   ],
   "stackInfo": {
      "categories": [
         {
            "_id": "5fa9a8fb455f9533d77500fb",
            "type": "IAB_PURPOSE",
            "name": "Store and/or access information on a device",
            "description": "Cookies, device identifiers, or other information can be stored or accessed on your device for the purposes presented to you."
         },
         {
            "_id": "5fa9a8fb455f9533d7750103",
            "type": "IAB_PURPOSE",
            "name": "Select basic ads",
            "description": "Ads can be shown to you based on the content you’re viewing, the app you’re using, your approximate location, or your device type."
         },
         {
            "_id": "5fa9a8fb455f9533d775010b",
            "type": "IAB_PURPOSE",
            "name": "Create a personalised ads profile",
            "description": "A profile can be built about you and your interests to show you personalised ads that are relevant to you."
         },
         {
            "_id": "5fa9a8fb455f9533d7750113",
            "type": "IAB_PURPOSE",
            "name": "Select personalised ads",
            "description": "Personalised ads can be shown to you based on a profile about you."
         },
         {
            "_id": "5fa9a8fb455f9533d775011b",
            "type": "IAB_PURPOSE",
            "name": "Create a personalised content profile",
            "description": "A profile can be built about you and your interests to show you personalised content that is relevant to you."
         },
         {
            "_id": "5fa9a8fb455f9533d7750122",
            "type": "IAB_PURPOSE",
            "name": "Select personalised content",
            "description": "Personalised content can be shown to you based on a profile about you."
         },
         {
            "_id": "5fa9a8fb455f9533d7750129",
            "type": "IAB_PURPOSE",
            "name": "Measure ad performance",
            "description": "The performance and effectiveness of ads that you see or interact with can be measured."
         },
         {
            "_id": "5fa9a8fb455f9533d7750131",
            "type": "IAB_PURPOSE",
            "name": "Measure content performance",
            "description": "The performance and effectiveness of content that you see or interact with can be measured."
         },
         {
            "_id": "5fa9a8fb455f9533d7750137",
            "type": "IAB_PURPOSE",
            "name": "Apply market research to generate audience insights",
            "description": "Market research can be used to learn more about the audiences who visit sites/apps and view ads."
         },
         {
            "_id": "5fa9a8fb455f9533d775013f",
            "type": "IAB_PURPOSE",
            "name": "Develop and improve products",
            "description": "Your data can be used to improve existing systems and software, and to develop new products"
         },
         {
            "_id": "5e37fc3e973acf1e955b8966",
            "name": "Use precise geolocation data",
            "description": "Your precise geolocation data can be used in support of one or more purposes. This means your location can be accurate to within several meters."
         }
      ],
      "language": "en"
   },
   "choiceOptions": [],
   "propertyId": 19298,
   "messageId": 0,
   "gdprApplies": true,
   "prtnUUID": null,
   "msgDescription": "",
   "bucket": 0,
   "uuid": "",
   "categoryId": 0,
   "subCategoryId": 0,
   "euconsent": "CPQJbvrPQJbvrAGABCENB2CgAAAAAHAAAAYgAAAMZgAgMZADCgAQGMhwAIDGRIAEBjIA.YAAAAAAAAAAA",
   "addtlConsent": "1~",
   "grants": {
      "5f369a02b8e05c308701f829": {
         "vendorGrant": false,
         "purposeGrants": {
            "5fa9a8fb455f9533d77500fb": false,
            "5fa9a8fb455f9533d7750103": true,
            "5fa9a8fb455f9533d775010b": true,
            "5fa9a8fb455f9533d7750113": true,
            "5fa9a8fb455f9533d7750129": false,
            "5fa9a8fb455f9533d7750137": false,
            "5fa9a8fb455f9533d775013f": false
         }
      },
      "5f1aada6b8e05c306c0597d7": {
         "vendorGrant": false,
         "purposeGrants": {
            "5fa9a8fb455f9533d77500fb": false,
            "5fa9a8fb455f9533d7750103": false,
            "5fa9a8fb455f9533d775010b": false,
            "5fa9a8fb455f9533d7750113": false,
            "5fa9a8fb455f9533d775011b": false,
            "5fa9a8fb455f9533d7750122": false,
            "5fa9a8fb455f9533d7750129": false,
            "5fa9a8fb455f9533d7750137": false,
            "5fa9a8fb455f9533d775013f": false
         }
      },
      "5e7ced56b8e05c4854221bb3": {
         "vendorGrant": false,
         "purposeGrants": {
            "5fa9a8fb455f9533d77500fb": false,
            "5fa9a8fb455f9533d7750103": false,
            "5fa9a8fb455f9533d775010b": false,
            "5fa9a8fb455f9533d7750113": false,
            "5fa9a8fb455f9533d775011b": false,
            "5fa9a8fb455f9533d7750122": false,
            "5fa9a8fb455f9533d7750129": false,
            "5fa9a8fb455f9533d7750131": false,
            "5fa9a8fb455f9533d7750137": false,
            "5fa9a8fb455f9533d775013f": false
         }
      },
      "5e7ced57b8e05c485246cce5": {
         "vendorGrant": false,
         "purposeGrants": {
            "5fa9a8fb455f9533d77500fb": false,
            "5fa9a8fb455f9533d7750103": false,
            "5fa9a8fb455f9533d7750129": false,
            "5fa9a8fb455f9533d775013f": false
         }
      }
   },
   "customVendorsResponse": {
      "consentedVendors": [],
      "consentedPurposes": [],
      "legIntPurposes": [
         {
            "_id": "5fa9a8fb455f9533d7750103",
            "name": "Select basic ads"
         },
         {
            "_id": "5fa9a8fb455f9533d775010b",
            "name": "Create a personalised ads profile"
         },
         {
            "_id": "5fa9a8fb455f9533d7750113",
            "name": "Select personalised ads"
         }
      ]
   },
   "cookies": [
      {
         "key": "consentUUID",
         "value": "2aef86a6-1129-4469-88ec-8ab0b93506a0",
         "maxAge": 31536000,
         "shareRootDomain": false,
         "session": false
      }
   ],
   "consentedToAll": null,
   "rejectedAny": null,
   "childPmId": null,
   "hasConsentData": false,
   "dateCreated": "2021-11-24T12:39:00.902Z"
}
Was this article helpful?
0 out of 0 found this helpful