Send a Slack Message Whenever a User Signs Up for your Site
Tags: wayscript, startup, tutorial
Published: 2020-10-19 11:48:34

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.

*   [Working with Form Trigger](https://docs.wayscript.com/library/triggers/form-trigger)
*   [Working with Verify Emails](https://docs.wayscript.com/library/modules/verify-emails)
*   [Working with conditionals](https://docs.wayscript.com/library/logic/conditionals)
*   [Working with Slack](https://docs.wayscript.com/library/modules/slack)

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](https://wayscript.com/blog_img/142/1.png)

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

![Email input](https://wayscript.com/blog_img/142/2.png)

The second input will be the name input.

![Full Name input](https://wayscript.com/blog_img/142/3.png)

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

![Form Page](https://wayscript.com/blog_img/142/4.png)

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](https://wayscript.com/blog_img/142/5.png)

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

![Configuring Verify Email](https://wayscript.com/blog_img/142/6.png)

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](https://wayscript.com/blog_img/142/7.png)

Your input will look like this.

![Condition input](https://wayscript.com/blog_img/142/8.png)

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](https://wayscript.com/blog_img/142/9.png)

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](https://wayscript.com/blog_img/142/10.png)

Your workflow should look like this.

![Workflow](https://wayscript.com/blog_img/142/11.png)

Conclusion
----------

Questions about this script or anything else? Join our [discord](https://discord.gg/VWbXSbj). We're always around to help. If you want to work the full script template, just find it [here](https://wayscript.com/user/mangabo_kolawole/cROP-Nt7
        ).