Skip to content

Instantly share code, notes, and snippets.

@HubSpotHanevold
Created September 16, 2025 19:54
Show Gist options
  • Save HubSpotHanevold/d1d0f87ddac06472ddeee32ac39c9a9f to your computer and use it in GitHub Desktop.
Save HubSpotHanevold/d1d0f87ddac06472ddeee32ac39c9a9f to your computer and use it in GitHub Desktop.
// Import the crypto module
const crypto = require('crypto');
exports.main = async (event, callback) => {
try {
// Example: variable from HubSpot workflow input or event
const inputValue = event.inputFields['hs_object_id'];
// Create a SHA-256 hash
const hash = crypto
.createHash('sha256')
.update(inputValue)
.digest('hex'); // hex output
// Return the hashed value
callback({
outputFields: {
hashedValue: hash
}
});
} catch (err) {
console.error(err);
throw err;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment