I came across a requirement where I need to archive the email sent to customer as PDF onto a different Archival platform.
I currently have the preview links synced to Salesforce, which expires after 180 days. Is there a way to move these emails as PDF to FTP?
I tried converting the html (by a get request to preview URL), but that does not seem an ideal way. Also the pdf is generated with html tags.
Is there a way to do this a better way?
There is really nothing you can do, to implement this natively in SFMC. My idea for such a solution would be following:
- Store the VAWP URL in sendlog. It will provide you with the web version of that unique email you have sent – which you will use to get the HTML.
- Create an automation which e.g. once every hour queries the sendlog and identifies entries not yet processed (using Query Activity) and places these in a separate data extension
- Create an instance of AWS Lambda, with an HTML renderer (like wkhtmltopdf) on it, and AWS S3 bucket to store the PDFs. This solution description is beyond the scope of SFSE, and I am confident other communities on StackExchange network can provide some advice.
- This lambda instance should expose an endpoint, which will receive the VAWP URL and a unique identifier. This identifier will be used to create the filename.
- For queueing purposes, you can consider AWS SQS, to ensure the wkhtmltopdf process will not be flooded with requests from SFMC.
- In SFMC, you should set up a Script Activity with SSJS which takes unprocessed records from the data extension described in #2, and provides the VAWP and unique identifier to SQS, marking the record as processed in sendlog.
- wkhtmltopdf will, once done, place the PDF files in your S3 bucket.
I know the above items are not described in adequate details to follow them and create the solution (especially when talking AWS components), but it should give you an idea on in which direction you should focus your efforts.