diff --git a/src/v0/destinations/sfmc/transform.js b/src/v0/destinations/sfmc/transform.js index 84050a13182..9c21b27f0a9 100644 --- a/src/v0/destinations/sfmc/transform.js +++ b/src/v0/destinations/sfmc/transform.js @@ -329,6 +329,46 @@ const retlResponseBuilder = async (message, destination, metadata) => { externalKey, token, }); + } else if (action === 'delete') { + let data = `\n + \n + ACCESS_TOKEN\n + \n + \n + \n + \n + CUSTOMER_KEY\n + \n + \n + FIELD_NAME\n + FIELD_VALUE\n + \n + \n + \n + \n + \n + `; + 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]); + 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; } }