I am attempting to use the Slack example found here Post User Registration Flow for a post registration Action. However, when I use the exact code I get “Must use import to load ES Module” error from Node.JS. When I follow the error instructions and use import I get “Cannot use import statement outside a module”. So I fell back to using the new dynamic import method await import('slack-notify') but that results in “no callback provided in dynamic import”. Has anyone seen this type of error? I triple checked my module and secrets configuration.
This is using Node16 for a post-registration Action.
Now how can I pass the channel name using slack webhook?
The documentation on Auth0 shows the way to use require(‘slack-notify’)… but when we add slack-notify in modules, it fails and gives the “Must use import to load ES Module” error.
let referrer_path = '';
const message = `New User: ${event.user.email} Came from ${JSON.stringify(api)} with the following ${JSON.stringify(event.request)} and the entire event contains ${JSON.stringify(event)}`;
const channel = '#marcoms';
slack.success({
text: message,
channel: channel
});
Hi @dan.woda
Thanks for the prompt reply - much appreciated.
Due to my ‘noob-ness’ I incorrectly configured the ‘@slack/webhook’ module. All working as expected. Out of interest are you able to explain why the documentation I followed wont work?