Organization creation action

Hi all,

I am trying to create a Zapier automation that will send a message to a slack channel whenever a new organization is created in our Auth0 tenant.

  • I understand I will need to create an action from scratch. What trigger do I need to select?

  • Will also need help with the action code

Thank you!

Sharing the action code from ChatGPT. Is this correct?

exports.onExecutePostUserRegistration = async (event, api) => {
  const fetch = require('node-fetch');

  // Organization details from the event
  const organization = event.organization;

  // Prepare the message
  const message = {
    text: `A new organization has been created: ${organization.name}`,
    // Add more details as needed
  };

  // Send the message to a webhook (e.g., Slack)
  const webhookUrl = 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL';
  await fetch(webhookUrl, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(message),
  });
};

Currently, we do not have a specific flow to trigger the “Create Organization” action. You can use logs to verify if an organization has been created or not.

Type should be - API Operation
Description - Create an Organization
details.name - Organization name

For your question, the Auth0 team needs to answer if they have any other options.

1 Like

Hey there @rubicon welcome to the community!

The code shared is executed on post user registration and not when an organization has been created.

As @vigneshSivasamy has mentioned, your best bet is going to be utilizing logs. In particular you will probably want to look into Log Streams and using a webhook.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.