Auth0 Home Blog Docs

How to add NPM packages to a Hook?



I am attempting to create a post-user-registration Hook that will update a user record in MailChimp. The MailChimp API requires the MD5 hash of the user email address as a resource identifier, so I need to be able to import the Node md5 package in my Hook source file. Unfortunately the md5 package is apparently unavailable in the default environment that Auth0 provides for Hooks.

Two questions:

  1. Is there a way for me to include additional Node packages in my Hook (similar to what Amazon Lambda allows)?
  2. Are there any plans to add the md5 package to the default Hooks environment?


You can add most NPM packages to the hooks you’re creating; in the tools action menu available in the webtask editor used to edit hooks there’s an NPM Modules options. See below:


You would then be able to require the module in the hooks code, something like var md5 = require("md5"); or use "md5@2.2.1" for the specific version you added.