@privapi/client-js
Version:
PRIVAPI NPM CLIENT PACKAGE
24 lines (18 loc) • 1.33 kB
JavaScript
import PrivapiClient from '../index.js';
// create new request
const createNewRequest = async () => {
const pc = new PrivapiClient(
'61e6da2ab264af65bdd1c5e2', // YOUR API KEY ID
'1d3a4af8-a624-48dc-b671-bg39feda400a' // YOUR API KEY SECRET
);
const params = {
dataSubjectIdentificationReference: '999999', // Identification reference to help you find the customer's data in your database, e.g. a unique customer number
requestType: 0, // Type of GDRP request, e.g. 0 for "Information Request"
products: ['61c0801fb5ba36f995db26d0'], // Array of products that the user has signed up for, products must be specified in the PRIVAPI PORTAL settings; you can leave this empty or undefined
// dataSubjectEmail: 'test@example.com', // Email of the data subject, use this field if you want the user to use the PRIVAPI RESPONSE PORTAL to receive updates on the request, instead of handlig it from within your digital offering (e.g. app. website); set to undefined if you prefer to handle responses from within your digital offering.
// identificationParameters: ['61f6b101e29cac9972f50921'], // identification parameter to be obtained from requestor (optional)
};
const result = await pc.createEncryptedRequest(params);
return result;
};
console.log(await createNewRequest().catch((error) => 'Error:' + error));