DEV Community

Derrick Sherrill for WayScript

Posted on

Send a Slack Message Whenever a User Signs Up for your Site

Introduction

Automating processes saves a lot of time and can help you focus on the real work or on the growth of your business.

Today we’ll build a script to send a slack message when new user signup for your website.

Prerequisites

There are no prerequisites for this tutorial. However, you can check these useful docs.

Trigger

We want to receive messages when a user sign-ups. We’ll use Form Trigger to build a simple form that accepts emails and Full Name. We’ll then verify the email and send a message on a Slack channel.

Add it as a new Trigger.

Adding Form Trigger

Once you’ve done, we can now configure the inputs. The first input will be the email input.

Email input

The second input will be the name input.

Full Name input

Now, turn on the Trigger and visit the page at the address in the module to make sure everything is working.

Form Page

Verify Emails

WayScript provides a simple module to verify emails in many ways: you can verify the format or even make sure the email exists.

Add it as a new step.

Adding Verify Email

Now, we’ll provide variables in the input and select Email Format for the input.

Configuring Verify Email

Sending Slack message

Before sending the message to Slack, we must do a comparison. We must be sure that the Email Format equals “Valid”.

Add If/Else conditionals as a new step.

Adding If/Else

Your input will look like this.

Condition input

As you’ve surely noticed, we have two branches: the If branch and the Else branch. If the condition is met, the script will execute the workflow in the If branch. If it’s not the case, it will follow the workflow of the Else branch.

Then, we’ll add the Slack module in the If branch.

Adding the Slack Module

Now you can configure and write the message you wish to send. I advise you to dedicate a channel for this kind of scripts. ;)

Slack messages

Your workflow should look like this.

Workflow

Conclusion

Questions about this script or anything else? Join our discord. We're always around to help. If you want to work the full script template, just find it here.

Top comments (0)