I'm trying to generate a QR code on a CloudPage in Salesforce Marketing Cloud using client-side JavaScript, then pass that QR code data to a SSJS script on the same CloudPage. The SSJS script is intended to send a POST request to the REST API to create a new asset in Content Builder with the QR code image data.

Here's the flow of the process:

  1. Generate the QR code on the client side.
  2. Convert the QR code to a data URL.
  3. Send the data URL to a SSJS script via a POST request.
  4. The SSJS script retrieves the data URL and uses it to send a POST request to the REST API.

I'm encountering an issue with step 4: the SSJS script is not able to properly capture the POSTed data from the client-side JavaScript. I'm currently using the Platform.Request.GetFormField method to retrieve the data, but it seems to not work for JSON data sent in the body of a POST request.

Given the limitations of SSJS in SFMC, how can I pass data from the client-side JavaScript to the SSJS script and then send it to the API? Are there any updates or new features in SFMC that can help with this scenario, or any workarounds that you can suggest?

  • If you are sending the JSON raw, there may be characters within that is breaking the URL string. Try Base64 Encoding the JSON before sending. Then Base64 Decode at the the receiving end.
    – Roy
    Jul 31 at 19:54
  • OP says it's being POSTed in the body, so won't be getting mangeld in the URL
    – Matt Lacey
    Aug 1 at 10:32


You must log in to answer this question.

Browse other questions tagged .