Skip to content

Commit

Permalink
feat: add deletion support for record events
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSudip committed Sep 6, 2024
1 parent 3e2cf8e commit d699fbf
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/v0/destinations/sfmc/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,46 @@ const retlResponseBuilder = async (message, destination, metadata) => {
externalKey,
token,
});
} else if (action === 'delete') {

Check failure on line 332 in src/v0/destinations/sfmc/transform.js

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

Move this "if" to a new line or add the missing "else"

Check failure on line 332 in src/v0/destinations/sfmc/transform.js

View workflow job for this annotation

GitHub Actions / Code Coverage

Move this "if" to a new line or add the missing "else"
let data = `<s:Envelope\n
xmlns:s="http://www.w3.org/2003/05/soap-envelope"\n
xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing"\n
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">\n
<s:Header>\n
<fueloauth>ACCESS_TOKEN</fueloauth>\n
</s:Header>\n
<s:Body\n
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n
xmlns:xsd="http://www.w3.org/2001/XMLSchema">\n
<DeleteRequest
xmlns="http://exacttarget.com/wsdl/partnerAPI">\n
<Objects xsi:type="DataExtensionObject">\n
<CustomerKey>CUSTOMER_KEY</CustomerKey>\n
<Keys>\n
<Key>\n
<Name>FIELD_NAME</Name>\n
<Value>FIELD_VALUE</Value>\n
</Key>\n
</Keys>\n
</Objects>\n
</DeleteRequest>\n
</s:Body>\n
</s:Envelope>`;
data = data.replace('ACCESS_TOKEN', token);
data = data.replace('CUSTOMER_KEY', externalKey);
data = data.replace('FIELD_NAME', destinationExternalId);
data = data.replace('FIELD_VALUE', message.fields[identifierType]);

Check failure on line 360 in src/v0/destinations/sfmc/transform.js

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

Use destructured variables over properties

Check failure on line 360 in src/v0/destinations/sfmc/transform.js

View workflow job for this annotation

GitHub Actions / Code Coverage

Use destructured variables over properties
const response = defaultRequestConfig();
response.method = defaultPostRequestConfig.requestMethod;
response.endpoint = `https://${subDomain}.soap.marketingcloudapis.com/Service.asmx`;
response.headers = {
soapaction: 'Delete',
'Content-Type': 'text/xml; charset="UTF-8"',
};
response.body.XML = {
payload: data,
};
return response;
}
}

Expand Down

0 comments on commit d699fbf

Please sign in to comment.