Introduction
Today, weβll use the WayScript platform to build a script to send Notification via Slack if Condition met in user-uploaded file.
Prerequisites
No prerequisites for this tutorial but here is the documentation worth reading.
Form Trigger
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.
Conditionals
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.
Conclusion
Questions about this script or anything else? Join our Discord. We're always around to help. If you want to work with the full script template, just find it here
Top comments (0)