Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: iterable EUDC deleteUsers #3881

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/v0/destinations/iterable/deleteUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils');
const { executeCommonValidations } = require('../../util/regulation-api');
const tags = require('../../util/tags');
const { JSON_MIME_TYPE } = require('../../util/constant');
const { constructEndpoint } = require('./config');

// Ref-> https://developers.intercom.com/intercom-api-reference/v1.3/reference/permanently-delete-a-user
// Ref-> https://support.iterable.com/hc/en-us/articles/360032290032-Deleting-Users
const userDeletionHandler = async (userAttributes, config) => {
if (!config) {
throw new ConfigurationError('Config for deletion not present');
}
const { apiKey } = config;
const { apiKey, dataCenter } = config;
if (!apiKey) {
throw new ConfigurationError('api key for deletion not present');
}
Expand All @@ -26,7 +27,8 @@ const userDeletionHandler = async (userAttributes, config) => {
const failedUserDeletions = [];
await Promise.all(
validUserIds.map(async (uId) => {
const url = `https://api.iterable.com/api/users/byUserId/${uId}`;
const endpointCategory = { endpoint: `users/byUserId/${uId}` };
const url = constructEndpoint(dataCenter, endpointCategory);
const requestOptions = {
headers: {
'Content-Type': JSON_MIME_TYPE,
Expand Down
36 changes: 36 additions & 0 deletions test/integrations/destinations/iterable/deleteUsers/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,40 @@ export const data = [
},
},
},
{
name: destType,
description: 'Test 5: should pass when dataCenter is selected as EUDC',
feature: 'userDeletion',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
destType: destType.toUpperCase(),
userAttributes: [
{
userId: 'rudder7',
},
],
config: {
apiKey: 'dummyApiKey',
dataCenter: 'EUDC',
},
},
],
},
},
output: {
response: {
status: 200,
body: [
{
statusCode: 200,
status: 'successful',
},
],
},
},
},
];
17 changes: 17 additions & 0 deletions test/integrations/destinations/iterable/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,22 @@ const deleteNwData = [
status: 200,
},
},
{
httpReq: {
method: 'delete',
url: 'https://api.eu.iterable.com/api/users/byUserId/rudder7',
headers: {
api_key: 'dummyApiKey',
},
},
httpRes: {
data: {
msg: 'All users associated with rudder7 were successfully deleted',
code: 'Success',
params: null,
},
status: 200,
},
},
];
export const networkCallsData = [...deleteNwData];
Loading