← View all announcements
New release
New release
New release
Nov 24, 2023

Use cryptographic utilities in hooks

If you need to send crypto-hashed data (like SHA256) to an API then this new hook functionality is for you.

Cloudhooks injects a variable named hookUtils into the javascript VM which can be used in hooks. hookUtils contains an object with packages and utility functions.

The hookUtils.crypto property contains Node's crypto package, so you can perform hashing like this:

module.exports = async function(payload, actions, context) {

  const secret = 'abcdefg';
  const hash = hookUtils.crypto.createHmac('sha256', secret)
                 .update('I love cupcakes')

  console.log('Generated hash: ', hash);

If you'd like to use other utility functions in hooks then let us know!