Today, we’ll use the WayScript platform to build a script to send Notification via Slack if Condition met in user-uploaded file.
No prerequisites for this tutorial but here is the documentation worth reading.
For the Trigger, we’ll use Form Trigger. The objective is to receive files, then run the script and the conditions following the Trigger.
Add it as a new Trigger.
Now we can configure the Trigger. First, let’s add useful information to the form.
We can now create the form element. Choose File input as element type and .pdf for extensions.
The next step is to put some conditions on the file before sending the Slack notification. For this tutorial, we’ll ensure that we are receiving a pdf file.
Add If/Else as a new step.
Once it’s done, we’ll add an input: the comparison. We’ll compare the extension of the file to “pdf” string.
Great. If you’ve noticed, adding an If/Else module creates two branches: one If the condition is valid (If branch) and one if the condition is invalid (Else). WayScript allows you to add many modules to the branches. It all depends on your needs. Well, in the If branch, add the Slack module.
If you’ve added the module, we can easily configure it now.
And now, let’s add a message.
Great! In the Else branch, I’ve added the Write to Log module, to print a message when the condition is not met.
if you’ve followed well this tutorial, here’s how your workflow should look like.
The Script is ready now. Be sure to have your Trigger turned on, so everyone can access the webpage.