Perform SHA-256 hashing on Tape

I’m trying to create a Facebook Conversion API integration with Tape, but I encountered a problem with SHA-256 hashing. The conversion API requires hashing information such as emails and phone numbers before sending them to Facebook.

It appears that Tape cannot do hashing.I tried using:

globalThis.crypto.subtle.digest('SHA-256', dataBuffer);

In the script, but got this error:

Action execution failed with error:
Cannot read properties of undefined (reading 'subtle')

This is critical to securely and adequately send Personally Identifiable Information (PII) to the Facebook Conversions API.

How can I perform SHA-256 hashing (to get a hex string output) within a Tape script?"

1 Like

Hi @Luis,

thanks for reaching out!

We currently do not expose the Node crypto API directly, and most likely will not be able to do that in the future.

However, having a dedicated SHA-256 utility function inside the Tape SDK for workflow automations could be an option - It would allow creating a SHA-256 hex hash from an arbitrary string input. :sunglasses:

Would having such a function solve your problem?

Let us check a potential implementation, this could be a low hanging fruit for our dev team. I will get back to you soon with a feedback.

Thank you &
Cheers
Tim

My current use case is with the Facebook Conversion API (see here). This API does not accept unhashed customer information (for my case, I need to hash first name, last name, email, and phone).

Sending unhashed data to Facebook’s Conversions API (CAPI) can result in my account being suspended or banned, as it violates Facebook’s policies and security standards.

If you guys can provide a function to make this happen, that will save me a lot of time. My script is straightforward, and I can easily adapt a SHA-256 utility function to it.

1 Like

Thanks for the update @Luis. Does your hashing need to be cryptographically secure?

If not, you could use a primitive utility that simply performs a “hashing like” transformation, to avoid directly exposing the content and also avoiding unwanted special characters.

I’m honestly not 100% sure. All the Facebook documentation says is Expected SHA256 output