SCIM Provisioning: A Comprehensive Guide to Simplifying User Management
Discover how SCIM provisioning can streamline your user account management, improve security, and enhance productivity.
This article will guide you through the process of integrating Authgear's Hooks and Events with Slack to send immediate notifications in Slack when a new user signs up.
User sign-ups are a crucial aspect of most web applications, and keeping track of them can provide valuable insights. Getting notified when a new user signs up is not just about knowing the numbers, but also about immediate user engagement. For example, you can send a welcome message or introduce them to special sign-up bonuses or offers as soon as they get authenticated in your system. When it comes to user authentication, Authgear provides an extensive suite of authentication features. What if you want to receive immediate notifications in Slack when a new user signs up?
There are many low-code tools to achieve this like Zapier and N8n. However, with Authgear you can integrate both authentication and sending messages. This article will guide you through the process of integrating Authgear's Hooks and Events with Slack to achieve just that.
As Authgear is an identity-as-a-service (IDaaS) platform that supports various authentication methods like social logins, passwordless, biometrics logins, one-time-password (OTP) with SMS/WhatsApp, and more. It has built-in customizable login pages, you do not have to spend time designing UI and implementing complex authentication flows. It's designed to be developer-friendly and has Hooks to react to different user-related events. Authgear offers an in-browser code editor where you can write JavaScript/Typescript code to add extra logic that is stored and runs on serverless infrastructure maintained by Authgear. We are going to use this capability to send Slack message after a new user sign up.
Before integrating Authgear, you'll need to create a webhook in Slack.
As you can see, I created a new workspace called authgear-example-sign-up:
Created a new Admin account there:
Initiated a new Slack channel named notification-sign-upwhere we receive a notification when a user signs up:
Navigate to the Slack API page, and create a new app from scratch. We use it to send the webhook information:
In the next step, you provide the app name and 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.
Under the "Add features and functionality" section, click on "Incoming Webhooks" and activate them.
Scroll down and click on "Add New Webhook to Workspace." Select the channel where notifications should be sent, and click "Allow.”
Scroll down and click on "Add New Webhook to Workspace." Select the channel where notifications should be sent, and click "Allow.”
With the Slack Webhook URL in hand, you can now set up the Authgear Hook to respond to the user.created event of non-blocking type.
Navigate to Advanced->Hooks section in the Authgear Portal. Add a new Non-blocking Event:
Choose the Hook Type as the TypeScript. You will write a function to respond to the user creation event and send a notification to Slack. Click on Edit Script under the Config option, it will bring you to the editor:
We want to send a POST request to a Slack webhook URL when EventUserCreated is triggered:
This async TypeScript function will run after a user is registered. Replace YOUR_SLACK_WEBHOOK_URL with the URL copied earlier. Once that is done, click on Finish Editing and Save the changes on the Hooks page.
After everything is configured, we can test the newly created hook in action. The easiest way to test it is by creating a new user from the User Management page in Authgear Portal manually.
After everything is configured, we can test the newly created hook in action. The easiest way to test it is by creating a new user from the User Management page in Authgear Portal manually.
Another way to validate it is when a new user goes through the sign-up process after you integrated your system with Authgear App and configured the login method for your users. Or you could also use the Try it now option on the Authgear dashboard's Getting Started page.
After you sign up with an email, Slack message will be sent:
Authgear's Hooks provides a customizable way to respond to user-related events. By integrating with Slack, you can receive real-time updates on user sign-ups directly in your preferred channel. Make sure to explore other events and tailor the integration to your specific needs!
How Profile Enrichment can boost your product