Tutorial: Automate Text Messages when Database Conditional Changes

tjmd

TJ-MD

Posted on May 1, 2020

Tutorial: Automate Text Messages when Database Conditional Changes

Thanks so much for the feedback on our rapid development platform! Here's a tutorial to introduce automation and workflows.

Introduction

Setting up automatic notifications can help you make better decisions, quicker. It can often be hard to create these automations if the decisions that need to be made are complex. For example, if we need to process datasets or filter selections before making decisions, these automations usually are more difficult to make. With WayScript, we can create these automations in minutes, while still having full control of our script.

Prerequisites

No prerequisites but some content you might find helpful:
Working with our SQL Module
Working with our Time Triggers
Working with our Text Messages

Automating an Action at Intervals

The automation part of this tutorial will occur with the time trigger. This will be the interval at which we want to check our database for the conditionals. On WayScript, we're able to easily automate complex interactions on a schedule. Whether you need to run a script by the day, hour, or minute, you can easily do this in our editor. To start programming on WayScript, sign up on the home page, or login to your account. We can create scripts, by clicking on the "+ New Script" at the top of the webpage. These scripts are what will house our automations.
We're able to automate anything on a schedule using time triggers. We can pull a time trigger into our workflow and configure the settings:

Settings 1

Settings 2

In this example, we'll use this time trigger to do periodic checks on our database, looking for the conditional change to send a text message alert for.

Querying our Database

To Query items in our database, we first need to drag in a SQL module into our workflow.

SQL module

Once we connect our database, this will give us access to a full editor that we can write SQL code into. If you get stuck while trying to set up your database, feel free to reference this Youtube tutorial. Let's write something like:

SELECT SUM(quantity)
FROM order_summary
WHERE product='A';

Once with have this information, we can compare it using conditionals in our workflow:

Workflow

The above image depicts an if statement which compares the value we pull from the database directly, to the value in the last run. We can store these values between runes using the variable storage module on WayScript. If the values are different, then a notification of your choice can be sent using the true branch of the if statement. In this example, we're using the built in text message module.

Questions, Concerns?

If there's any questions feel free to message us on discord. We're happy to help! If you want to see this full script template, you can find it here. There's also a video of this tutorial on our YouTube channel.

Meet Derrick from WayScript, the star of these videos and creator of these amazing tutorials:

derricksherrill image
💖 💪 🙅 🚩
tjmd
TJ-MD

Posted on May 1, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related