I was working on a zap in Zapier the other that that would take someone’s email address when they bought a product on ClickFunnels, then create an SHA-256 hash of it and send it to TikTok’s API to track conversions.
But when I googled how to make a hash in Zapier, I was surprised to find out that there was no information — and I mean no information — about how to do this on the web. So I kept trying and my zap kept breaking until I finally figure it out.
Here’s how I did it.
How to Create an SHA-256 Hash in Zapier
The best way to create a hash in Zapier is to write a few lines of Python code that do the hashing and run them with the Code by Zapier step.
Step 1: Go to your Zapier and open the zap for editing.
Step 2: Add a “Code by Zapier” action where you want the hashing to happen.
Step 3: Under “Event,” select “Run Python.”
Step 4: Click on the blue “Continue” button.
Step 5: Under “Input Data,” enter string_to_hash
in the field on the left.
Step 6: Now select the field whose value you want to hash from the dropdown menu on the right. This must be a field that already exists in the zap’s trigger or one of the previous steps.
Step 7: Copy the Python code snippet below and paste it into the “Code” field. I’ve written the code so that you don’t have to make any changes to it whatsoever for it to work.
The Python code snippet:
import hashlib
encoded_string = input_data['string_to_hash'].encode('utf-8')
hashed_string = hashlib.sha256(encoded_string).hexdigest()
output = [{'hashedString': hashed_string}]
And the screenshot of where it goes:
Step 8: Click on the blue “Continue” button.
Step 9: Test your zap. It will generate an SHA-256 hash called “hashedString” that you can use in any of the subsequent steps in your zap.