Workaround for Velocity loading Java libraries

Level 1

Workaround for Velocity loading Java libraries

I use a basic method for hashing data for linking to customers (sending them a URL that points to a survey for recent service, for example). This process uses base64 and string2hex, both of which are native to the SalesForce Marketing Cloud application (we are still running on SFMC and currently migrating to Marketo).

I am currently working on replicating this functionality in Marketo, but unfortunately due to the recent removal of classtools and contexttools from Velocity, we can no longer accomplish this as far as we understand it. From my understanding, Java Utilities is where that functionality was accomplished in Velocity and we simply cannot load those encryption libraries any more. I have been playing with email-script-tokens and webhooks all day with zero success. I then found this article (https://nation.marketo.com/community/product_and_support/blog/2018/07/17/sha-256-ing-an-email-addres...) and tried to re-engineer the code for my purpose, but again with no avail. And then I saw at the bottom of that article/comments that loading java libraries is no longer supported with the loss of classtools and contexttools.

Got an error message in my account when I was building an email-script-token: Unsupported Velocity Tools in your Email Script MyTokens

https://nation.marketo.com/docs/DOC-6953

We need a valid method for encrypting data within Marketo during time-of-send and would like to avoid processing this data in another application (more storage, more API calls). Any pro-tips or workarounds would be very helpful if available!

5 REPLIES 5
Highlighted
Level 10 - Community Moderator

Re: Workaround for Velocity loading Java libraries

You have to call a webhook-compatible service for this now. I was very sorry to see it go, as were our clients.

Highlighted
Level 1

Re: Workaround for Velocity loading Java libraries

Thank you for your response, Sanford Whiteman. I don't think that will work for my use-case. We need the processed data to go to a custom object and from my understanding, web hooks do not support that.

Highlighted
Level 10 - Community Moderator

Re: Workaround for Velocity loading Java libraries

Correct, you can't pass CO data to a webhook. We actually have 2 clients passing CO data to an SMTP-to-HTTP gateway via alerts, then updating CO fields via REST API.

Works, not easy on API calls of course. You'd be better off setting the fields at the start if you can (even by setting up an API Gateway that changes the payload on the fly as the COs are created.)

Highlighted
Level 3

Re: Workaround for Velocity loading Java libraries

One other option, if you have the time, would be to implement hexadecimal conversion and base64 encoding directly in Velocity. It might be overkill, but I believe (meaning I haven't tired it myself) it's possible.

The algorithms to accomplish each of these tasks are described clearly here:

Neither of these links is hosted by Marketo: caveat emptor.

Each algorithm is pretty simple. You'll likely need MathTool (VelocityTools 3.0-SNAPSHOT API)  for both tasks.

Also, consider if hex encoding is actually necessary. In many cases, a decimal format can also be used.

Highlighted
Level 10 - Community Moderator

Re: Workaround for Velocity loading Java libraries