<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: TJ-MD</title>
    <description>The latest articles on DEV Community by TJ-MD (@tjmd).</description>
    <link>https://dev.to/tjmd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F362429%2F876a861d-c1c7-44c5-8771-727eeebe2179.png</url>
      <title>DEV Community: TJ-MD</title>
      <link>https://dev.to/tjmd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tjmd"/>
    <language>en</language>
    <item>
      <title>Tutorial: Building a Slack Bot that Writes Custom Queries against your Database</title>
      <dc:creator>TJ-MD</dc:creator>
      <pubDate>Tue, 19 May 2020 15:32:20 +0000</pubDate>
      <link>https://dev.to/wayscript/tutorial-building-a-slack-bot-that-writes-custom-queries-against-your-database-2j04</link>
      <guid>https://dev.to/wayscript/tutorial-building-a-slack-bot-that-writes-custom-queries-against-your-database-2j04</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hey everyone! In this one, let's take a look at how we can allow users to query a database, even when they might not know any sql. In this tutorial, we'll build a system that takes a slack message keyword, queries a database using it, and returns a response.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Some understanding of regular expressions and SQL will be beneficial. Also, here's the documentation that covers the topics we'll use:&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/slack"&gt;Working with Slack&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/regex"&gt;Working with Regex&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/sql"&gt;Working with SQL&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Slack Trigger
&lt;/h2&gt;

&lt;p&gt;Our workflow should look something like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User submits a slack message containing string that will trigger the desired action.
&lt;/li&gt;
&lt;li&gt;The string needs to be extracted using regular expressions
&lt;/li&gt;
&lt;li&gt;The string extracted needs to query our database
&lt;/li&gt;
&lt;li&gt;The queried value needs to be returned to the user as a slack message.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To start off, we need to look for messages posted into the channel we want these operations to occur in. So we'll need a slack trigger for that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gsRvLS8N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gsRvLS8N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/1.png" alt="trigger"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We're able to configure this trigger how ever we would like. We can choose the workspace and the channel. Additionally, we need to be sure to select the output we want.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--h1ABFadU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--h1ABFadU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/2.png" alt="output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, we're selecting the slack message text. This creates a variable below, inside the variables panel, that we can refer to in the next step. This will be what we apply our regular expression to.&lt;/p&gt;
&lt;h2&gt;
  
  
  Conditional and Regular Expression
&lt;/h2&gt;

&lt;p&gt;For the next step, we only want to return a response if a keyword is found. We'll just use "?" as a trigger to let us know we need to perform an action. We can do this by dragging in an if statement, and configuring it to check if the question mark character is present in the string.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xUVg2pB0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xUVg2pB0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/3.png" alt="conditional statement"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1VIa9LAB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1VIa9LAB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/4.png" alt="inputs"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Querying the Database - Regex Pattern
&lt;/h2&gt;

&lt;p&gt;Since we now know when to return a response, let's work on generating that response. The first step is to know what the specific response is that we need. We can extract words from our trigger symbol (?) using regular expressions, and then pass this on to an SQL module.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xNCxV8lT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xNCxV8lT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/5.png" alt="sql"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The regular expression settings in my script look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1mCUvGO1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1mCUvGO1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/6.png" alt="regular expression"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The regular expression inserted will just look for the contents following a question mark, and then we can return those contents as a captured group.&lt;/p&gt;
&lt;h2&gt;
  
  
  Querying the Database - Building the SQL Statement
&lt;/h2&gt;

&lt;p&gt;Now that we've successfully captured the text we want, we can use this to write our SQL statement. We'll drag in an SQL module below our regex module:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k7yCA3I_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k7yCA3I_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/7.png" alt="regex"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this SQL module, we can write our SQL using that captured group. Your statement might look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RgZNgdhJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RgZNgdhJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/8.png" alt="sql"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my example, we're looking for the first instance and returning this value. This is what we'll write back to slack. At this step, there's also the availability to write back multiple outputs from your SQL database.&lt;/p&gt;
&lt;h2&gt;
  
  
  Writing Back to SQL
&lt;/h2&gt;

&lt;p&gt;Now that we've returned the value back from the database, we can easily write it to Slack using a Slack module.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XBxIS9se--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XBxIS9se--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/90/9.png" alt="Slack"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Need Help?
&lt;/h2&gt;

&lt;p&gt;If there's any questions feel free to message us on &lt;a href="https://discord.gg/nchf9E9"&gt;Discord&lt;/a&gt;. We're happy to help! If you want to see this full script template, you can find it &lt;a href="https://wayscript.com/user/derricks/1-zmqOhZ"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/wnFvooLAKWg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>sql</category>
      <category>slack</category>
      <category>regex</category>
    </item>
    <item>
      <title>Tutorial: Build Personalized Discord Bots with WayScript</title>
      <dc:creator>TJ-MD</dc:creator>
      <pubDate>Fri, 15 May 2020 13:58:13 +0000</pubDate>
      <link>https://dev.to/wayscript/tutorial-build-personalized-discord-bots-with-wayscript-30a8</link>
      <guid>https://dev.to/wayscript/tutorial-build-personalized-discord-bots-with-wayscript-30a8</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Creating bots can be tedious depending on the software you use. Discord bots are no exception to this. While other platforms have unnecessary limitations, WayScript provides a solution that is robust enough to cover every use case. If we don't have it, then we give you the tools to create it for yourself using a programming language. Let's see how we can create custom discord bots using &lt;a href="https://wayscript.com/"&gt;WayScript&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Prefer to watch vs read, check out the video tutorial at the end of this post.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;No prerequisites but some content you might find helpful:&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/discord"&gt;Working with Discord&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/python"&gt;Working with python&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Monitoring Discord Messages
&lt;/h2&gt;

&lt;p&gt;In this example, we want an action to occur whenever an event happens in discord. We can accomplish this using the discord trigger provided by Wayscript. We can pull this into the trigger slot of our workflow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N0x0urwW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/83/2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N0x0urwW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/83/2.png" alt="trigger"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first time you use discord, you will be accessed to authorize it and choose the channel you want to connect your bot to.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aivul68d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/83/3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aivul68d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/83/3.png" alt="discord"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You are also able to choose the authorizations you want to provide to Wayscript. Next, we need to configure our discord trigger's settings. We have multiple options here such as mode and the channel we want to monitor.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_hcPkB_C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/83/4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_hcPkB_C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/83/4.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating Bot Responses
&lt;/h2&gt;

&lt;p&gt;There's several different ways we can create these responses in WayScript. Since we provide fully customizable tools in the programming language modules, you're able to build advanced bots very easily with your programming language of choice. In this example, let's pass the entire message text to a python module, preform some regular expression matching, and return a response.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cvLcGH26--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/83/5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cvLcGH26--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/83/5.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We're matching these keyword searches against a python dictionary of keywords and actions created with the create variable step. The python code would look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;keywords&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;variables&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'keywords'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;re&lt;/span&gt;
&lt;span class="err"&gt;​&lt;/span&gt;
&lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;r'\![a-z]*'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;matches&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;findall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;󰀂&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;1.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Discord_Message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="err"&gt;󰀂&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;matches&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;keywords&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"matches"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="err"&gt;​&lt;/span&gt;
&lt;span class="n"&gt;variables&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'action'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Sending back a Discord Response
&lt;/h2&gt;

&lt;p&gt;Once we match keywords to our dictionary of keys and actions, we can write back a discord response as the bot.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dHOWYhGI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/83/6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dHOWYhGI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/83/6.png" alt="response"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Need Help?
&lt;/h2&gt;

&lt;p&gt;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 &lt;a href="https://wayscript.com/user/derricks/rLntoEqY"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Embed YouTube&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/sWpAfML5h0I"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>beginners</category>
      <category>discord</category>
      <category>python</category>
    </item>
    <item>
      <title>Tutorial: Trigger a Python Script Using Slack</title>
      <dc:creator>TJ-MD</dc:creator>
      <pubDate>Wed, 13 May 2020 12:55:06 +0000</pubDate>
      <link>https://dev.to/wayscript/tutorial-trigger-a-python-script-using-slack-lb0</link>
      <guid>https://dev.to/wayscript/tutorial-trigger-a-python-script-using-slack-lb0</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/DJo1uCyNWKE"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Chances are that you are already using Slack in your personal or workplace communications. Let's learn how we can make your slack channels even more powerful with &lt;a href="https://wayscript.com/" rel="noopener noreferrer"&gt;WayScript&lt;/a&gt;. In this tutorial, let's take a look at how we can execute python code whenever a message is sent to a specified channel in slack.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;No prerequisites but some content you might find helpful:&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/slack" rel="noopener noreferrer"&gt;Working with Slack&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/python" rel="noopener noreferrer"&gt;Working with Python&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Activating a Script with Slack
&lt;/h2&gt;

&lt;p&gt;In WayScript, we activate our scripts using triggers. We have a variety of different triggers available, but in this tutorial, let's use a slack trigger.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F87%2F1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F87%2F1.png" alt="Trigger"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This slack trigger allows us to activate the workflow depending on the event type. In this example, let's say we want to activate whenever a message is posted to a certain, specified channel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F87%2F2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F87%2F2.png" alt="Slack"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, if we want to create personalized response depending on the message text, we can create a variable using the outputs. We do this by selecting the output "Slack Message Text."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F87%2F3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F87%2F3.png" alt="Message"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Passing the Slack Message to Python
&lt;/h2&gt;

&lt;p&gt;Since we imported the variable of slack message text into our workflow, we can access it anywhere downstream of the trigger. Let's use it in a python module to send back personalized results.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F87%2F4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F87%2F4.png" alt="pass message"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, we have limitless options on what we can do with the user's input. We could send requests to different APIs, process the posted data, lookup the data against our databases, and so much more. An example personalized response may be something like sending a request to the website the user has posted in their slack message.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;

&lt;p&gt;&lt;span class="c1"&gt;# reading in the variable we created in slack into our python script&lt;br&gt;
&lt;/span&gt;&lt;span class="n"&gt;python_variabe_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;variables&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Slack_Message_Text&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;br&gt;
&lt;span class="err"&gt;​&lt;/span&gt;&lt;br&gt;
&lt;span class="c1"&gt;# import default modules&lt;/span&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  If a module isn't already imported, you can install your own modules using the requirements.txt
&lt;/h1&gt;

&lt;p&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class="c1"&gt;# Custom get request depending on slack message contents&lt;br&gt;
&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;python_variable_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;br&gt;
&lt;span class="n"&gt;website_status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class="c1"&gt;# "Exporting" the variable from python back into the wayscript editor&lt;br&gt;
&lt;/span&gt;&lt;span class="n"&gt;variables&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;wayscript_variable_status&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;website_status&lt;/span&gt;&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Sending a Slack Response&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;We have created the variable we want to send back to the user whenever they post into slack with python, so now we just need a final slack module to finish this operation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F87%2F5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F87%2F5.png" alt="slack response"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This time, instead of pulling data, we'll be writing data to the same channel the user posted into.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F87%2F6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F87%2F6.png" alt="slack channel"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will write the custom response back to the user whenever they post in that channel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Need Help?
&lt;/h2&gt;

&lt;p&gt;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 &lt;a href="https://wayscript.com/user/derricks/N06ui2CQ" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>python</category>
      <category>slack</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Tutorial: Introduction to Programming with WayScript</title>
      <dc:creator>TJ-MD</dc:creator>
      <pubDate>Tue, 12 May 2020 14:19:23 +0000</pubDate>
      <link>https://dev.to/wayscript/tutorial-introduction-to-programming-with-wayscript-2di5</link>
      <guid>https://dev.to/wayscript/tutorial-introduction-to-programming-with-wayscript-2di5</guid>
      <description>&lt;p&gt;&lt;em&gt;Hi Dev Community! Below is an introductory post to help you get started with &lt;a href="https://wayscript.com/"&gt;WayScript&lt;/a&gt;. As you can see, the possibilities are endless. As a developer, if you find yourself frustrated by the restrictions with low-code platforms, we think you'll enjoy the robustness of WayScript.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The challenges associated with learning any software can be daunting. At &lt;a href="https://wayscript.com/"&gt;WayScript&lt;/a&gt;, we try to make design decisions that limit these obstacles for developers and make it extremely easy to begin using the software. If you're a developer with some knowledge of python or javascript, the interactions on WayScript should almost feel instinctual.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some terminology
&lt;/h2&gt;

&lt;p&gt;While some of the terminology from other programming languages is applied here as well, such as variables, variable types, etc. There is some unique terminology that applies directly to WayScript that will be used throughout this post.&lt;br&gt;
&lt;/p&gt;
&lt;li&gt;Script - Created in the WayScript editor, containing trigger(s) and module(s) which perform actions.
&lt;/li&gt;
&lt;li&gt;Trigger - Refers to a code block that can be used to activate your script, found at the beginning of the script.
&lt;/li&gt;
&lt;li&gt;Module - A code block containing functionality, often linked to a third party service's API.

&lt;p&gt;In short, we create scripts which perform actions. These actions are executed whenever the conditional of the trigger is true, such as at a certain time of day or when X happens on a third party software. The actions that happen are created using modules and programming logic.&lt;/p&gt;
&lt;h2&gt;
  
  
  Working with Triggers
&lt;/h2&gt;

&lt;p&gt;Triggers are what activates actions within a script besides manually executing them. By learning how to properly use triggers, we are able to unlock some really cool automations. Here's a snapshot of the triggers we have available at the time of writing. We're always adding more, so if the trigger you need isn't currently available, please suggest it to us.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z-y7Yxml--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/88/1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z-y7Yxml--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/88/1.png" alt="triggers"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each of these triggers have different activation events. Let's go through some of our user's favorites.&lt;br&gt;
&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;Time Trigger - Activates your script at certain time intervals.
&lt;/li&gt;
&lt;li&gt;HTTP Trigger - Activates your script whenever your URL is visited. This can be used to return HTML content too, providing you your own WayScript hosted site.
&lt;/li&gt;
&lt;li&gt;Slack - Activates your script whenever conditions in a slack channel are met, such as message contents or message channel.
&lt;/li&gt;
&lt;li&gt;Discord - Behaves very similarly to the slack trigger
&lt;/li&gt;
&lt;li&gt;GitHub - Activates your script whenever github events happen such as pushes to a branch

&lt;p&gt;Of course, there's plenty more with the triggers available, this is just a list to help you understand how triggers work. It is also important to note that multiple triggers can be placed onto one script. This may be useful if you want your script to run every hour AND when a user posts in a slack channel for example.&lt;/p&gt;

&lt;h2&gt;
  
  
  Working with Packages
&lt;/h2&gt;

&lt;p&gt;Packages make it easy to use third party API's in your script. These are code blocks that you can place into your script. These will execute the actions you specify whenever the script is either manually executed or a trigger activates. We have a large library of packages available and always adding more as well. Here's a snapshot of packages we have available at the time of writing:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TxRzFLIQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/88/2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TxRzFLIQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/88/2.png" alt="Packages"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These integrations should make it easy to begin automating workflows from across different softwares.&lt;/p&gt;

&lt;h2&gt;
  
  
  Programming Logic - Limitless Solutions
&lt;/h2&gt;

&lt;p&gt;While WayScript may seem similar to other software platforms available. The key difference is the availability to include your own programming logic into your workflow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z_-lZBq---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/88/3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z_-lZBq---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/88/3.png" alt="logic"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is this a big deal?
&lt;/h2&gt;

&lt;p&gt;A common worry with software that tries to automate tasks across different third party solutions, is how limited the actions are. If you are unable to program your own tools into any software, you will eventually find restrictions no matter how robust the software is.&lt;/p&gt;

&lt;p&gt;At &lt;a href="https://wayscript.com/"&gt;WayScript&lt;/a&gt;, we know real life problems are not needing cookie cutter solutions, but rather customized solutions that fully handle your specific problem. This is why you're able to build them yourself using fully integrated programming language modules. There are limitless possibilities on what you can build. We just try to make it easy to build them. Hopefully, this allows you to spend less time making systems work together and more time building what you need.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Any questions or need a hand? Please take a look at our &lt;a href="https://docs.wayscript.com/"&gt;Documentation&lt;/a&gt;, comment below or join us on &lt;a href="https://discord.gg/nchf9E9"&gt;Discord&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;


&lt;/li&gt;

</description>
      <category>tutorial</category>
      <category>beginners</category>
      <category>automation</category>
      <category>python</category>
    </item>
    <item>
      <title>Tutorial: Execute Python Scripts Via Text Message</title>
      <dc:creator>TJ-MD</dc:creator>
      <pubDate>Mon, 11 May 2020 14:26:52 +0000</pubDate>
      <link>https://dev.to/wayscript/tutorial-execute-python-scripts-via-text-message-5dj8</link>
      <guid>https://dev.to/wayscript/tutorial-execute-python-scripts-via-text-message-5dj8</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this tutorial, let's take a look at how we can execute a python script whenever we send a text message to a specific number using &lt;a href="https://wayscript.com/"&gt;WayScript&lt;/a&gt;. Additionally, we'll look at how we can pass variables to a python script using this text message to create custom responses. Let's get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  Text Message Trigger
&lt;/h2&gt;

&lt;p&gt;The WayScript text message trigger allows us to execute a script whenever a text message is sent to a certain number, containing an execution command for the script you're trying to execute. For example, the text may look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qZUuQlJh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qZUuQlJh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/1.png" alt="text example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Building this in WayScript, we pull a time trigger into our workflow and turn it on:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UtLwKBC9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UtLwKBC9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/2.png" alt="Time Trigger"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first time you use this module, you will have to connect your phone number for verification. After that, we can configure the outputs to receive from the test message. These are the values following the execution command in your message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J1DtPh3r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J1DtPh3r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/3.png" alt="Output variables"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we're creating a variable called message, which will get assigned the value provided in the text message.&lt;/p&gt;

&lt;h2&gt;
  
  
  Executing a Python Script
&lt;/h2&gt;

&lt;p&gt;Since we want this text message to execute a python script, let's pull a python module as the next step in the workflow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_yKHoeDy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_yKHoeDy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/4.png" alt="python module"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By placing this under an activated text message trigger, this python script will execute any time a message is received. However, to provide a customized response, let's do something with the input provided by the user's message.&lt;/p&gt;

&lt;p&gt;We could write some python code like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;variables&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'message'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;string_message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;response_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'Hello '&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;string_message&lt;/span&gt;
&lt;span class="n"&gt;variables&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'response_string'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response_string&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;While we're not doing much here, we're taking the input, processing it, and creating a new variable that we can pass to another module. We can "export" this new variable out of python and back to Wayscript using the variables dictionary. There's limitless possibilities at this step.&lt;/p&gt;
&lt;h2&gt;
  
  
  Passing Back a Response
&lt;/h2&gt;

&lt;p&gt;Now that we've created the response in the python module. Let's pass it back as a text message to the user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z-1QNKj4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z-1QNKj4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/5.png" alt="Text message"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can write the response that we want into the body of the message. But in this example, let's just use that variable we created by dragging it in.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Xf-jT0u6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Xf-jT0u6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/6.png" alt="response"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will return that python response directly back to the user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nJulkhfe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nJulkhfe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/89/7.png" alt="response"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Questions, Feedback?
&lt;/h2&gt;

&lt;p&gt;As always, if you have any questions please reach out to us on our &lt;a href="https://discord.gg/nchf9E9"&gt;Discord&lt;/a&gt; and we would be happy to help. If you want to view this completed script, you can find it &lt;a href="https://wayscript.com/user/derricks/hv5ZoHOi"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Meet and connect with Derrick from WayScript. The star of these scripts and creator of these amazing tutorials: &lt;/p&gt;
&lt;div class="ltag__user ltag__user__id__185410"&gt;
  
    .ltag__user__id__185410 .follow-action-button {
      background-color: #0030b3 !important;
      color: #ffffff !important;
      border-color: #0030b3 !important;
    }
  
  &lt;a href="/derricksherrill" class="ltag__user__link profile-image-link"&gt;
    &lt;div class="ltag__user__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AY-V9fzw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--147mjex8--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/185410/b7540d7f-8da5-4650-b080-7152160d6b1e.png" alt="derricksherrill image"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a href="/derricksherrill" class="ltag__user__link"&gt;Derrick Sherrill&lt;/a&gt;
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a href="/derricksherrill" class="ltag__user__link"&gt;
        Software developer who sometimes makes videos
      &lt;/a&gt;
    &lt;/div&gt;
    &lt;p class="ltag__user__social"&gt;
        &lt;a href="https://github.com/Derrick-Sherrill" rel="noopener"&gt;
          &lt;img class="icon-img" alt="github logo" src="https://res.cloudinary.com/practicaldev/image/fetch/s--C74Jn3f1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo.svg"&gt;Derrick-Sherrill
        &lt;/a&gt;
    &lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>python</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>automation</category>
    </item>
    <item>
      <title>Tutorial: Update Airtable Rows with mySQL data and Python Processing</title>
      <dc:creator>TJ-MD</dc:creator>
      <pubDate>Thu, 07 May 2020 13:27:47 +0000</pubDate>
      <link>https://dev.to/wayscript/tutorial-update-airtable-rows-with-mysql-data-and-python-processing-4816</link>
      <guid>https://dev.to/wayscript/tutorial-update-airtable-rows-with-mysql-data-and-python-processing-4816</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/q3KNsvtIFqM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Connecting mySQL, python, and airtable has never been this easy to do. In this example using &lt;a href="https://wayscript.com/" rel="noopener noreferrer"&gt;WayScript&lt;/a&gt;, let's walk through ho we can pull information from a mySQL database, process it using python programming, and then input that data into our Airtable database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;No prerequisites but some content you might find helpful:&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/sql" rel="noopener noreferrer"&gt;Working with databases&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/triggers/time-trigger" rel="noopener noreferrer"&gt;Working with CRON&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/airtable" rel="noopener noreferrer"&gt;Working with Airtable&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/python" rel="noopener noreferrer"&gt;Working with Python&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Activating a Script Routinely
&lt;/h2&gt;

&lt;p&gt;To activate any script on WayScript at set intervals, on certain days, or at certain time, we offer the use of the time trigger:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F74%2F1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F74%2F1.png" alt="time trigger"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We're able to do anything fancy that you might want to using full CRON syntax to denote when we want to activate our script.&lt;/p&gt;

&lt;p&gt;For the purposes of simplicity, let's make our's run everyday.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F74%2F2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F74%2F2.png" alt="Schedule"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we have this, anything contained in this tree will be executed, everyday, at 7AM.&lt;/p&gt;
&lt;h2&gt;
  
  
  Connecting our Database
&lt;/h2&gt;

&lt;p&gt;To connect our database, we'll need to drag it into our workflow below our time trigger.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F74%2F3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F74%2F3.png" alt="database connection"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once here, we'll need to provide some information for WayScript to be able to read/write your database. If you need help with setting up your database, our documentation has a full video and text walkthrough. As with anything else, if you get stuck feel free to reach out to us on our discord as well.&lt;/p&gt;
&lt;h2&gt;
  
  
  Using a Date time module
&lt;/h2&gt;

&lt;p&gt;If we want to pass today's date to airtable each time we execute our script, we can use the date time module.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F86%2F1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F86%2F1.png" alt="date time"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This gives us access to a variable in our variables panel that we can pass to airtable later on.&lt;/p&gt;
&lt;h2&gt;
  
  
  Executing your Database Action
&lt;/h2&gt;

&lt;p&gt;Now that we have the database in the workflow, we're able to write SQL statements and execute those against our tables just like how we would locally. Click edit code to the left:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F74%2F4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F74%2F4.png" alt="edit code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will give us access to the text editor, in which we can write our own custom code. Let's just put something simple in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;SELECT&lt;/span&gt; &lt;span class="nc"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;survey&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will give us back the query value as a variable we can use throughout the rest of our script.&lt;/p&gt;

&lt;h2&gt;
  
  
  Processing with Python
&lt;/h2&gt;

&lt;p&gt;To process the data that we pull from airtable with python, we can pull in a python module below the SQL module.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F86%2F2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F86%2F2.png" alt="python"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From here we can edit the code and write something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;sum_a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;variables&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Column_0&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sum_a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="err"&gt;​&lt;/span&gt;
&lt;span class="n"&gt;sum_b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sum_a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sum_b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="err"&gt;​&lt;/span&gt;
&lt;span class="n"&gt;variables&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sum_b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sum_b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We're just doing a bare bones processing operation here of multiplying our value by two, but this step could be much more depending on your requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Passing to Airtable
&lt;/h2&gt;

&lt;p&gt;Once the variable is passed back from the python module, we can input it into airtable. Drag an airtable module below this python step and then configure the settings:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F86%2F3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.wayscript.com%2Fblog_img%2F86%2F3.png" alt="airtable"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We're writing the values that we created throughout the steps to our airtable, using the create a new record mode.&lt;/p&gt;

&lt;h2&gt;
  
  
  Questions, Need Help?
&lt;/h2&gt;

&lt;p&gt;If you have any questions, comment below or feel free to message us on &lt;a href="https://discord.gg/nchf9E9" rel="noopener noreferrer"&gt;Discord&lt;/a&gt;. We're happy to help! If you want to see this full script template, you can find it &lt;a href="https://wayscript.com/user/derricks/Rm1K-7HQ" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>mysql</category>
    </item>
    <item>
      <title>Tutorial: Integrating your app with Slack in 3 Minutes</title>
      <dc:creator>TJ-MD</dc:creator>
      <pubDate>Wed, 06 May 2020 13:39:13 +0000</pubDate>
      <link>https://dev.to/wayscript/tutorial-integrating-your-app-with-slack-in-3-minutes-c10</link>
      <guid>https://dev.to/wayscript/tutorial-integrating-your-app-with-slack-in-3-minutes-c10</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we will build a Slack messaging system for a web app using &lt;a href="https://wayscript.com/"&gt;WayScript&lt;/a&gt;. We integrate Slack in a demo web app built using &lt;a href="http://flask.pocoo.org/"&gt;Flask&lt;/a&gt; with Python and pushing the data to Slack using WayScript.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you prefer to watch vs. read, check out the video at the bottom of this post&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The WayScript / Slack integration allows you to rapidly build a process for custom Slack messaging. This can be used for custom error reporting, status messaging, recording user interactions, and much more. With WayScript, you can get slack integrated into your code in 3 minutes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/wayscript/code_snippets/tree/master/flask_demo"&gt;Here is a GitHub Repo sample server you can use for testing.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step One: Setting up WayScript
&lt;/h2&gt;

&lt;p&gt;Select Build From Scratch from the Dashboard&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EKc3b6fl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/build_from_scratch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EKc3b6fl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/build_from_scratch.png" alt="Build from scratch"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, we name the program 'Slack Reporter'. Pressing create brings you into the WayScript Editor.&lt;/p&gt;

&lt;h2&gt;
  
  
  Set up a Webhook API Trigger
&lt;/h2&gt;

&lt;p&gt;We are going to pass data from our web app to WayScript via a POST Request api call. To set up your WayScript recipe to trigger when a request is received, drag in the 'Trigger' module from the Logic Modules.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jBYl5_bc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/drag_trigger.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jBYl5_bc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/drag_trigger.png" alt="trigger"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have dragged in the Trigger Module, change the trigger mode from Time to Web Hook.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gS5siAAQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/webhook_select.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gS5siAAQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/webhook_select.png" alt="Webhook select"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To set up the Trigger Module, we want to tell the Module what data will be passed through the Webhook. For this example, we are going to pass a single string called 'Message'. Under Outputs, add a variable and name it Message. This message variable can now be used in later steps of your recipe (in this case we can pass the message to Slack).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xC_DQU2u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/trigger_output.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xC_DQU2u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/trigger_output.png" alt="slack"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step Two: Set up the Slack API
&lt;/h2&gt;

&lt;p&gt;Drag the Slack module from the Library as the second step in your recipe.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_-o0bNXL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/slack_step.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_-o0bNXL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/slack_step.png" alt="slack step"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, select the channel you want to pass your message to.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IwXKpcC5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/slack_channel_select.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IwXKpcC5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/slack_channel_select.png" alt="slack channel"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under Inputs, select your message variable as the message to pass to Slack.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mi9ufs4e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/slack_message_select.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mi9ufs4e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/slack_message_select.png" alt="message select"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, type in the name of your 'Bot'.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hHs7Six4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/create_bot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hHs7Six4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/create_bot.png" alt="bot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step Three: Implement the Webhook in your Code
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;requests&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;json&lt;/span&gt;
&lt;span class="err"&gt;​&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;send_to_slack&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'https://wayscript.com/api'&lt;/span&gt;

    &lt;span class="n"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s"&gt;'api_key'&lt;/span&gt;    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;#TODO, Insert API KEY 
&lt;/span&gt;                     &lt;span class="s"&gt;'program_id'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;#TODO, Insert Program ID
&lt;/span&gt;                     &lt;span class="s"&gt;'variables'&lt;/span&gt;  &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;​&lt;/span&gt;
    &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;#This sends the message to your 
&lt;/span&gt;&lt;span class="n"&gt;WayScript&lt;/span&gt; &lt;span class="n"&gt;Script&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Your API Key and Program ID are available to copy and paste from the Trigger Module (see image above).&lt;/p&gt;

&lt;p&gt;Now every time your code executes, your bot will post your message to Slack!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ej8qYwk_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/slack_post.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ej8qYwk_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/35/slack_post.png" alt="slack post"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Other
&lt;/h2&gt;

&lt;p&gt;The Slack API also allows you to send messages to Users not just channels. To do this, change the mode from 'Work with Channels' to 'Work with Users', then select the user to message.&lt;/p&gt;

&lt;p&gt;The Trigger Module also lets you pass multiple variables not just one. Just comma separate these in your post request.&lt;/p&gt;

&lt;p&gt;Let us know your thoughts in the comments below or to our &lt;a href="https://discord.gg/nchf9E9"&gt;Discord&lt;/a&gt; channel.&lt;/p&gt;

&lt;p&gt;Here's a video of this tutorial featuring Jesse a co-founder of WayScript.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/aVl-ixd7gL8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>python</category>
      <category>flask</category>
      <category>slack</category>
    </item>
    <item>
      <title>Tutorial: Building a GET API with WayScript</title>
      <dc:creator>TJ-MD</dc:creator>
      <pubDate>Tue, 05 May 2020 15:31:56 +0000</pubDate>
      <link>https://dev.to/wayscript/tutorial-building-a-get-api-with-wayscript-1lc2</link>
      <guid>https://dev.to/wayscript/tutorial-building-a-get-api-with-wayscript-1lc2</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;WayScript makes it really easy to make a fully fleshed out APIs in minutes. Today we'll be be discussing how to make a GET API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;In order to make the API, we'll utilize an HTTP Trigger, a SQL Module, a Python Module, and an HTTP Response. There are no prerequisites but some content you might find helpful:&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/http-response"&gt;Working with HTTP&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/python"&gt;Working with Python&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/sql"&gt;Working with SQL&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Building the GET API
&lt;/h2&gt;

&lt;p&gt;With WayScript, you can set up a workflow really quickly.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZThpHZzZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/startAPP.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZThpHZzZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/startAPP.PNG" alt="New Script"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can create a workflow by clicking the &lt;code&gt;+ New Script&lt;/code&gt; Button in the top right corner of the website.&lt;/p&gt;

&lt;p&gt;In this Script, to make a workflow he using the HTTP Trigger module, which will make a request to our database any time we hit a valid endpoint. Modules are sort of like building blocks, to help form the foundation of our application. After adding the HTTP Trigger Module to the workflow, click on the module and go to the window in the left to add endpoints and query paramters for your API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Wd_o0hG0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/addendpoint.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wd_o0hG0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/addendpoint.PNG" alt="add endpoint"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After adding the query parameters we can get going with connecting to our SQL database and using the query parameters from our HTTP Trigger.&lt;/p&gt;

&lt;p&gt;First, click the SQL Module. WayScript allows you to sink up with a MySQL, PostgresSQL, or SQL Server DB and is adding new ones all the time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IqikaohE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/sqlSetUp.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IqikaohE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/sqlSetUp.PNG" alt="MySQL"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you put in your DB info you. You can query it and alter the qurey so that you can use one of the parameters from your HTTP Trigger.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x-I10OVH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/useQueryParameterInSql.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x-I10OVH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/useQueryParameterInSql.PNG" alt="Query parameter"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we can query the database to get the entry that we want! Make sure to set up indexes at the columns you would like to use.&lt;/p&gt;

&lt;p&gt;Next you need to take the information from your Database response and turn it into a JSON response with the Python Module.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VS6OZzy2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/PythonModuleCode.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VS6OZzy2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/PythonModuleCode.PNG" alt="Python code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the Python Module and create a JSON response and put it in your dictionary as resp so you can reference it later.&lt;/p&gt;

&lt;p&gt;WayScript type checks your dictionary variables so they make it really easy to know if you formatted your response correctly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IdPzfN2B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/httpResponse.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IdPzfN2B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/httpResponse.PNG" alt="http response"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you add your response to your HTTP Response module and turn on the HTTP Trigger you're good to go!&lt;/p&gt;
&lt;h2&gt;
  
  
  Result
&lt;/h2&gt;

&lt;p&gt;If you call or go to the endpoint at the supplied query parameters you can see your response!  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---8Q--IYZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/validJSON.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---8Q--IYZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/85/validJSON.PNG" alt="valid json"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you would like to see this example app check out &lt;a href="https://wayscript.com/user/erik_toor/9FL_bX4B"&gt;this script with GET and POST requests&lt;/a&gt;, it is public on the WayScript market place. Also feel free to check out other scripts on the &lt;a href="https://wayscript.com/marketplace"&gt;WayScript Market Place&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here's a great video of Erik Toor building this Script. &lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/HZxo52iuPMg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Tutorial: Running Selenium in the cloud on a daily cron schedule</title>
      <dc:creator>TJ-MD</dc:creator>
      <pubDate>Mon, 04 May 2020 13:36:46 +0000</pubDate>
      <link>https://dev.to/wayscript/tutorial-running-selenium-in-the-cloud-on-a-daily-cron-schedule-3ifj</link>
      <guid>https://dev.to/wayscript/tutorial-running-selenium-in-the-cloud-on-a-daily-cron-schedule-3ifj</guid>
      <description>&lt;p&gt;&lt;em&gt;Start your Monday off with a super short tutorial using Selenium on &lt;a href="https://wayscript.com/"&gt;WayScript&lt;/a&gt;. Questions about WayScript? Check out our &lt;a href="https://wayscript.com/faq"&gt;FAQ&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Selenium is a library for automating web browser tasks. With WayScript, you can run selenium code on the cloud on an automated schedule without needing to set up a server or any other infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up your Cron Scheduler
&lt;/h2&gt;

&lt;p&gt;Under triggers, select the &lt;a href="https://docs.wayscript.com/library/triggers/time-trigger"&gt;Time Trigger&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dkr_I55---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/43/time_trigger.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dkr_I55---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/43/time_trigger.png" alt="time trigger"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, set the cadence and time that you want your script to run at (ex. every day at 9am, or once a week on Thursdays, etc.).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--79JA61YI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/43/time_trigger_mod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--79JA61YI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/43/time_trigger_mod.png" alt="trigger mod"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up your Python Script
&lt;/h2&gt;

&lt;p&gt;Drag the &lt;a href="https://docs.wayscript.com/library/modules/python"&gt;Python Module&lt;/a&gt; into your WayScript flow&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---nkNc7bd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/43/python_module.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---nkNc7bd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/43/python_module.png" alt="mod"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup your Selenium Headless Browser
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;selenium&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;webdriver&lt;/span&gt;

&lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;webdriver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ChromeOptions&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add_argument&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'--headless'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add_argument&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'--no-sandbox'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="err"&gt;​&lt;/span&gt;
&lt;span class="n"&gt;browser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;webdriver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Chrome&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;set_page_load_timeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="err"&gt;​&lt;/span&gt;
&lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'https://wayscript.com/'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="err"&gt;​&lt;/span&gt;
&lt;span class="n"&gt;ps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;page_source&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="err"&gt;​&lt;/span&gt;
&lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  All done! Now your selenium code will run
&lt;/h2&gt;

&lt;p&gt;You can also &lt;a href="https://docs.wayscript.com/library/modules/python#outputs"&gt;output data from Python&lt;/a&gt; to use in other modules such as sending emails, slack messages, etc.&lt;/p&gt;

</description>
      <category>selenium</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>python</category>
    </item>
    <item>
      <title>Tutorial: Automate Text Messages when Database Conditional Changes</title>
      <dc:creator>TJ-MD</dc:creator>
      <pubDate>Fri, 01 May 2020 12:33:23 +0000</pubDate>
      <link>https://dev.to/wayscript/tutorial-automate-text-messages-when-database-conditional-changes-5hce</link>
      <guid>https://dev.to/wayscript/tutorial-automate-text-messages-when-database-conditional-changes-5hce</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/fqFKpPXi0qc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thanks so much for the feedback on our &lt;a href="https://www.wayscript.com"&gt;rapid development platform&lt;/a&gt;! Here's a tutorial to introduce automation and workflows.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;No prerequisites but some content you might find helpful:&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/sql"&gt;Working with our SQL Module&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/triggers/time-trigger"&gt;Working with our Time Triggers&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/text-message"&gt;Working with our Text Messages&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Automating an Action at Intervals
&lt;/h2&gt;

&lt;p&gt;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.&lt;br&gt;
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:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--16zWwIDZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/76/1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--16zWwIDZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/76/1.png" alt="Settings 1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l4RlAIz8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/76/2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l4RlAIz8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/76/2.png" alt="Settings 2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;
&lt;h2&gt;
  
  
  Querying our Database
&lt;/h2&gt;

&lt;p&gt;To Query items in our database, we first need to drag in a SQL module into our workflow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--19vwzBg4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/76/3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--19vwzBg4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/76/3.png" alt="SQL module"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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:&lt;/p&gt;

&lt;pre&gt;
SELECT SUM(quantity)
FROM order_summary
WHERE product='A';
&lt;/pre&gt;

&lt;p&gt;Once with have this information, we can compare it using conditionals in our workflow:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fDo1gjJp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/76/4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fDo1gjJp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/76/4.png" alt="Workflow"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;
&lt;h2&gt;
  
  
  Questions, Concerns?
&lt;/h2&gt;

&lt;p&gt;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 &lt;a href="https://wayscript.com/user/derricks/qTc-gQR5"&gt;here&lt;/a&gt;. There's also a &lt;a href="https://youtu.be/fqFKpPXi0qc"&gt;video&lt;/a&gt; of this tutorial on our &lt;a href="https://www.youtube.com/channel/UCv1JpM-XII0PMnqoCJfZA2g"&gt;YouTube channel&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Meet Derrick from WayScript, the star of these videos and creator of these amazing tutorials: &lt;/p&gt;
&lt;div class="ltag__user ltag__user__id__185410"&gt;
  
    .ltag__user__id__185410 .follow-action-button {
      background-color: #0030b3 !important;
      color: #ffffff !important;
      border-color: #0030b3 !important;
    }
  
  &lt;a href="/derricksherrill" class="ltag__user__link profile-image-link"&gt;
    &lt;div class="ltag__user__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AY-V9fzw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--147mjex8--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/185410/b7540d7f-8da5-4650-b080-7152160d6b1e.png" alt="derricksherrill image"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a href="/derricksherrill" class="ltag__user__link"&gt;Derrick Sherrill&lt;/a&gt;
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a href="/derricksherrill" class="ltag__user__link"&gt;
        Software developer who sometimes makes videos
      &lt;/a&gt;
    &lt;/div&gt;
    &lt;p class="ltag__user__social"&gt;
        &lt;a href="https://github.com/Derrick-Sherrill" rel="noopener"&gt;
          &lt;img class="icon-img" alt="github logo" src="https://res.cloudinary.com/practicaldev/image/fetch/s--C74Jn3f1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo.svg"&gt;Derrick-Sherrill
        &lt;/a&gt;
    &lt;/p&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>tutorial</category>
      <category>sql</category>
      <category>automation</category>
    </item>
    <item>
      <title>Tutorial: Creating a COVID-19 Twitter Bot</title>
      <dc:creator>TJ-MD</dc:creator>
      <pubDate>Thu, 30 Apr 2020 14:38:57 +0000</pubDate>
      <link>https://dev.to/wayscript/tutorial-creating-a-covid-19-twitter-bot-2i07</link>
      <guid>https://dev.to/wayscript/tutorial-creating-a-covid-19-twitter-bot-2i07</guid>
      <description>&lt;p&gt;&lt;em&gt;We love when our Community members share how they are using WayScript. Erik Toor created this great &lt;a href="https://youtu.be/6LdZRJPh7rk"&gt;video&lt;/a&gt; using Python and WayScript, and below is a step by step tutorial. If you'd like to share what you're building with WayScript, let us know.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;With everything that's been going on in the world there is a need for easily accessible public information during COVID-19. Today, we'll be discussing how a college student, Erik Toor, used WayScript to help make information for COVID-19 more accessible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making a COVID-19 TwitterBot
&lt;/h2&gt;

&lt;p&gt;In order to make the TwitterBot, Erik utilizes a Time Trigger, a Python Script, and our Twitter Plugin. To code something like Erik there are no prerequisites but some content you might find helpful:&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/twitter"&gt;Working with Twitter&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.wayscript.com/library/modules/python"&gt;Working with Python&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Building the Script
&lt;/h2&gt;

&lt;p&gt;With WayScript, you can set up a workflow fairly quickly.&lt;br&gt;
You can create a workflow by clicking the &lt;code&gt;+ New Script&lt;/code&gt; Button in the top right corner of the website.&lt;/p&gt;

&lt;p&gt;In Erik's Script, to make a workflow he using the Time-Trigger module, Erik allows himself to Tweet COVID-19 updates daily. Modules are sort of like building blocks, to help form the foundation of our application. Then through adding the Twitter Module, and signing in one-tap with his Twitter, he is ready to post Tweets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B05clxJL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/84/covid19TwitterBotFlow.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B05clxJL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/84/covid19TwitterBotFlow.png" alt="Twitter Module"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After creating the workflow, Erik edits the Python Module's code so that he can write up his steps for creating COVID-19 updates.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: Python code can be found in his &lt;a href="https://wayscript.com/user/erik_toor/18370"&gt;script&lt;/a&gt; you can clone&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9CiLA-Ey--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/84/covid19TwitterBotCode.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9CiLA-Ey--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/84/covid19TwitterBotCode.png" alt="Twitter Bot COde"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To edit, a Python Module once you have placed it in your workflow, just click the Python Module &amp;gt; Hover Over scratch.py &amp;gt; Edit Code. Then you can change the Python Code however, you want!&lt;/p&gt;

&lt;p&gt;In Erik's Python Module, he defined a Function &lt;code&gt;getCovidInfo(country)&lt;/code&gt;, which gets information based off the country you request. Because he uses the loop module later in his workflow, he can add unlimited tweets for unlimited countries so that anyone can get information on COVID-19 cases in their country.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LDc7ZhKq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/84/covid19TwitterBotCode2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LDc7ZhKq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/84/covid19TwitterBotCode2.png" alt="Twitter Bot Code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can download any Python library you need with WayScript automatically! Here, Erik writes helper functions to make web requests with Python and format his tweet. He imports &lt;code&gt;urllib.request&lt;/code&gt; and &lt;code&gt;json&lt;/code&gt;. He uses the urllib.request library to request data from an API written by students at his school called TrackCorona.live.&lt;/p&gt;

&lt;h2&gt;
  
  
  Result
&lt;/h2&gt;

&lt;p&gt;Erik is able to tweet daily updates for coronavirus. Good work!  If you want to checkout Erik's full video, see the link below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mdk9VByU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/84/covid19TwitterFeed.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mdk9VByU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/84/covid19TwitterFeed.png" alt="Twitter Feed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Video
&lt;/h3&gt;

&lt;p&gt;Check out the step-by-step tutorial on &lt;a href="https://youtu.be/6LdZRJPh7rk"&gt;Erik's YouTube Channel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you would like to see Erik's workflow or work with his &lt;a href="https://wayscript.com/user/erik_toor/18370"&gt;script&lt;/a&gt;, it is public on the WayScript market place. Also feel free to check out other scripts on the &lt;a href="https://wayscript.com/marketplace"&gt;WayScript Market Place&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>tutorial</category>
      <category>twitter</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Tutorial: WayScript for DevOps Automation</title>
      <dc:creator>TJ-MD</dc:creator>
      <pubDate>Wed, 29 Apr 2020 15:05:13 +0000</pubDate>
      <link>https://dev.to/wayscript/tutorial-wayscript-for-devops-automation-3ih9</link>
      <guid>https://dev.to/wayscript/tutorial-wayscript-for-devops-automation-3ih9</guid>
      <description>&lt;h2&gt;
  
  
  WayScript uses WayScript
&lt;/h2&gt;

&lt;p&gt;WayScript uses WayScript to simplify and automate many of our DevOps processes. We make heavy use of our own &lt;a href="https://github.com/wayscript/wayscript-python"&gt;Python API&lt;/a&gt; for error tracking and performance monitoring on the live site. We also use our WayScript API for reporting during our AWS deployment process.&lt;/p&gt;

&lt;p&gt;In this article, we'll show you some of the ways we use WayScript to make our developers' lives easier and our site more reliable, with the hope that you will be able to use WayScript to improve your own DevOps workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deployment Status Notifications
&lt;/h2&gt;

&lt;p&gt;One pain point of our deployment process was that our developers were unaware of when a deployment was taking place or what the status was of an ongoing deployment.&lt;/p&gt;

&lt;p&gt;Our team uses Slack, so we decided to solve this problem by using the WayScript API to send deployment updates to a Slack channel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--trIMdCgI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/42/deployment_program.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--trIMdCgI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/42/deployment_program.png" alt="Slack"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a Deployment Program
&lt;/h2&gt;

&lt;p&gt;To send these Slack notifications throughout our deployment process, we created a "Deployment" program.&lt;br&gt;
This program serves three main functions:&lt;br&gt;
Send a link to the deployment progress page when a deployment begins.&lt;br&gt;
Notify the team that a deployment has completed.&lt;br&gt;
Notify the team that an autoscaling event has occurred.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nLN0niT1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/42/deployment_tracker.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nLN0niT1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/42/deployment_tracker.png" alt="Notifications"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While it may look complicated, the program flow is pretty simple.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The program starts out with a Webhook Trigger so that it can be triggered by an API call.&lt;/li&gt;
&lt;li&gt;When the message is received, a series of if/else statements determines what type of message to send to Slack, based on the arguments passed to the Webhook Trigger.&lt;/li&gt;
&lt;li&gt;The Slack Module sends the message to our developers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7f3v2VRc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/42/deployment_program_tree.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7f3v2VRc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/42/deployment_program_tree.png" alt="send message"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Calling the WayScript API During the Deployment Process
&lt;/h2&gt;

&lt;p&gt;We use &lt;a href="https://aws.amazon.com/codedeploy/"&gt;AWS CodeDeploy&lt;/a&gt; for our deployments. The CodeDeploy configuration allows you to use &lt;a href="https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html"&gt;"hooks"&lt;/a&gt; to run different shell scripts or lambda functions at different stages of the deployment lifecycle. By calling the WayScript API from these hooks, we can easily track the progress of our deployment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BJX1gW9d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/42/aws_deployment_lifecycle.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BJX1gW9d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/42/aws_deployment_lifecycle.png" alt="Track progress"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is an example of calling the WayScript API from a shell script. This example will run a "Deployment" program, with the argument "Deployment Started!".&lt;/p&gt;

&lt;pre&gt;WS_API_KEY="your_api_key"  # Get this from your Profile page

PROGRAM_ID=1234  # ID of your WayScript "Deployment" program

​
python -c "from wayscript import WayScript; WayScript('$WS_API_KEY').run_program($PROGRAM_ID, 'Deployment Started!')"&lt;/pre&gt;

&lt;p&gt;Of course, for this to work, you'll need to have the WayScript Python Library installed on your application instance.&lt;/p&gt;

&lt;pre&gt;pip install wayscript&lt;/pre&gt;

&lt;h2&gt;
  
  
  Other DevOps Notifications
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Debug Logs
&lt;/h3&gt;

&lt;p&gt;Often, there are times when the development team wants to know if certain events occurred in the code, but doesn't want to dig through various debug logs to find them. These debug events are another great use case for the WayScript API and Slack Module.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pohIZ8M8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/42/debug_to_slack_tree.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pohIZ8M8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/42/debug_to_slack_tree.png" alt="Slack"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Warnings and Critical Errors
&lt;/h2&gt;

&lt;p&gt;Most of the time, we're ok with sending debug event notifications to a Slack channel that the development team occasionally monitors, but some errors are critical enough that we want to alert the team with an &lt;a href="https://wayscript.com/documentation/module/smtp_email"&gt;email&lt;/a&gt; or &lt;a href="https://wayscript.com/documentation/module/text_message"&gt;text message&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To achieve this, we can expand on the debug program above by also passing a "Log Level" argument via our WayScript API call. We can then branch on the value of "Log Level" to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Write to Slack "If Log Level is the same as Debug"&lt;/li&gt;
&lt;li&gt;Send an email "If Log Level is the same as Warning"&lt;/li&gt;
&lt;li&gt;Send a text message "If Log Level is the same as Error"&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Performance Monitoring
&lt;/h2&gt;

&lt;p&gt;Similar to the way we use WayScript for debugging and error reporting, we can also use WayScript to alert us on performance regressions.&lt;/p&gt;

&lt;p&gt;For example, we could send API performance data to WayScript, store it in an &lt;a href="https://docs.wayscript.com/library/modules/excel"&gt;Excel&lt;/a&gt; file, and run analysis on top of that data, such as determining if a value crosses a certain threshold, or &lt;a href="https://wayscript.com/documentation/module/calculator"&gt;changes by a certain percent&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  General Site Notifications
&lt;/h2&gt;

&lt;p&gt;We also utilize WayScript API calls to notify us of general site activity, such as a user submitting feedback or a bug report.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ensure that Your Site is Always Reachable
&lt;/h2&gt;

&lt;p&gt;You can even use WayScript to detect if your site goes down or becomes unreachable. Create a program that uses the &lt;a href="https://docs.wayscript.com/library/modules/python"&gt;Python Module&lt;/a&gt; to ping your site. If the ping fails, send an email. Add a &lt;a href="https://wayscript.com/documentation/trigger/time_trigger"&gt;Time Trigger&lt;/a&gt; to your program to run it every ten minutes (or every minute), and voila, you will now get an email from WayScript if your site goes down!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BBAZIXux--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/42/ping.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BBAZIXux--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.wayscript.com/blog_img/42/ping.png" alt="Trigger"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sky's The Limit
&lt;/h2&gt;

&lt;p&gt;These are just a few of the ways WayScript uses WayScript to simplify our DevOps workflows and ensure our site is performant and reliable. There are endless ways to use the WayScript API to innovative and enhance your DevOps activities.&lt;/p&gt;

&lt;p&gt;We'd love to hear how your team uses the WayScript API in your application. As always, feel free to drop us a line at &lt;a href="mailto:founders@wayscript.com"&gt;founders@wayscript.com&lt;/a&gt; with success stories, feedback, or suggestions for new functionality that would make your DevOps workflows easier.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>beginners</category>
      <category>devops</category>
      <category>python</category>
    </item>
  </channel>
</rss>
