Send Slack Message After New User Sign Up with Auth0 Actions
Tags: webdev, programming, tutorial
Published: 2022-01-28 15:38:17

### Use Auth0 Actions with webhooks to send a Slack message after a new user signs up.

### <br>

Having a new person sign up for your website is an exciting experience. You feel a rush of energy every time someone chooses your service, enters their email and password into a "Log in" form, and clicks "Sign Up." Get that jolt of excitement in real-time by creating an Auth0 Action to send a message to Slack when a new user registers an account.

## What You Need

* Auth0 Account. If you do not have one, you can sign up for a <a href="https://auth0.com/signup" data-amp-replace="CLIENT_ID" data-amp-addparams="anonId=CLIENT_ID(cid-scope-cookie-fallback-name)">free Auth0 account</a>.

* Application in our Auth0 tenant. Any web-based, mobile, or desktop application will work. If you don't have any applications that use Auth0, you can download one from the [Auth0 Quickstarts](https://auth0.com/docs/quickstarts/) page.

* Slack account. If you belong to a Slack workspace, you already have one. If you don't have a Slack account, don't worry — you can create one after creating a Slack workspace.

* Slack workspace. You need access to a Slack workspace where the admins will approve your app, or one where you're an admin. If neither of these apply to you, follow the steps in the next section, where you'll set up a Slack workspace under your administrative control.


## Create a Slack Workspace

To approve apps in Slack, you need admin permissions. If you don't have a Slack workspace that you are the admin of, you can create your own free Slack workspace that will give you admin privileges. Go to the Slack [Get Started page](https://slack.com/get-started#/createnew). 

Enter your email address and click **Continue**, or continue with Apple or Google. Check your email for a confirmation code. Enter your code, then click **Create a Workspace**. Go through the following pages to name the workspace and a channel. You can skip inviting people for this example. Congrats! Now you have a workspace, and you can create a Slack webhook.

## Create a Slack Webhook

To post messages into Slack from outside sources, you need a webhook URL. [Webhooks](https://en.wikipedia.org/wiki/Webhook) enable apps to "talk" to each other when something new happens. In this post, you'll take the email address the user entered into the Auth0 login box and send it to Slack as a message.

First, you'll need an app in your Slack workspace to send the webhook information to your Slack channel. Go to [api.slack.com](https://api.slack.com) and click **Create an app**.

![Slack API homepage](https://images.ctfassets.net/23aumh6u8s0i/1r6NCn0k67X5fm6n418hPm/2bccddd6addc4eab2a8d312ad130adca/api.slack.com.png)

This will bring up the _Create an App_ modal. Click **From scratch**. 

The next modal you'll see is _Name app & choose workspace_. Fill in an app name; you can use "slack-test" if you can't come up with something better. You can always change the name later when you think of something else. 

Then select the workspace that you want to connect the app to. Make sure this is the correct app because you can't change the app's workspace later. After you pick a workspace, click **Create App**.

![Slack Name app & create workspace modal](https://images.ctfassets.net/23aumh6u8s0i/2gEJlNDHCE4pAVsnVK5pQ5/3820f59a4a5517fc32bfaff0dae304e6/name_app_workspace_page.png)

You'll be taken to the Basic Information page. This page is where you turn on the ability to use webhooks and get your webhook URL. On the left side of the page, Click **Incoming Webhooks**. Click the toggle button on, and Slack will create a bot user if you don't already have one.

[Read more...](https://auth0.com/blog/send-slack-message-after-sign-up-with-auth0-actions/?utm_source=content_synd&utm_medium=sc&utm_campaign=actions)