How to create a 'You're Awesome' bot
- Get link
- X
- Other Apps
Some days you need just a little boost to your self esteem, something to tell you just how good you are. And I’ve noticed that, even with bribes of chocolate, my coworkers just aren’t stepping up with that, so I made a bot that will do it for me.
My bot is called AwesomeBot and even features my dog, Oscar:
That said, I’ve found that if something happens on too much of a schedule, I tend to ignore it after a while (just ask my snooze button). So, I made a Zap to set up a bot that will send me all the inspiration I need, but on a much more random basis. With this bot, I find myself taking a few seconds to stop, read the message, appreciate it, feel good about it, and then go back to what I was doing.
Craft a You’re Awesome bot of your very own
Note: This is a seven-step Zap, meaning you'll need to either be in your trial period or have a paid account to use it. It also uses a fair number of tasks, so be aware of that as you set how often it will run.
This template will get you most of the way there. Click here to get started with the "You're Awesome" bot. From that page, you'll want to click the blue TRY IT button. (Keep reading for a walk-through of exactly how to set up this Zap.)
We want this Zap to be completely random, so it needs to run on random days and also at a random time. Zapier doesn’t currently have a way to trigger randomly, so we’ll need to get a little creative with our workflow to get this working.
Step 1: Schedule by Zapier
Our trigger step will use the Schedule by Zapier app. We’ll set this to run only on workdays and during work hours so you’re not cluttering up your Slackbot channel when you’re not in the office.
From there we can add a conditional requirement that will randomly determine whether or not the Zap should continue. While we could use the information that comes through our trigger step, that won’t give us as much randomness as we’re hoping for.
Step 2: Formatter by Zapier
So, let’s add in a step to make this even more random. One of the lesser known tools in our Formatter toolbox is Pick From List, which can output a random item from the list you set up.
You can add pretty much anything in your list, but for our bot, let’s do a simple list from 1 - 10. If you want your Bot to run more often, you can make this a shorter list, and if you want it to run less frequently, make your list even longer.
Step 3: Filter by Zapier
Next, we’ll add the conditional requirement to decide whether we should run the bot today. We'll use a Filter step to do that. Again, you can impact the frequency of the Bot running by increasing the number of possible conditions available. I personally don’t run it too often, so mine runs if the number generated from my pick from list is greater than 7.
https://ift.tt/33vOcOB
If I wanted to see my bot more often, I could lower the number, or change the conditional to less than 7.
With these three steps, we now have a Zap that runs on a random day. So, let’s look at how to randomize the time of day our Zap will run.
If we go with an 8-hour day, that gives us 480 minutes to play with. While we could use the "Pick from List" option we used above, that would take a considerable amount of set up. Since Zapier is all about making things faster, let’s look at another way we can get a random number from those 480 minutes.
Step 4: Formatter by Zapier (Spreadsheet Formula)
To do this, we can use another Formatter tool—Spreadsheet Formula. This function will let us choose from a number of formulas to get the result we’re after.
One of these options is RANDBETWEEN, which lets us set two numbers, and generate a random number between them. In this example, we want a number between 1 and 480. The set up will look like this:
Step 5: Delay by Zapier
Once we have this random number, we can set our Zap to delay for this number of minutes. You’ll notice we picked a number starting at 1 instead of 0. This is because our Delay by Zapier app has a minimum delay of 1 minute.
In this delay step, we’ll map the output of our spreadsheet formula as the Time Delayed For.
And with this, we have set our Zap to run randomly during our work day.
Step 6: Giphy
Finally, we need to grab an image to send. To do this, let’s look at one of the largest image libraries available—Giphy. Our Giphy app lets us add a keyword, and will return the URL of an image based on that search term.
The search term you set here is entirely up to you. While I like a "you’re awesome" message, I’ve seen cute animals, inspirational messages, and even Tom Hanks quotes.
Step 7: Slack
In our last step, the link that’s returned from our Giphy step will be sent in our Slack message. Your message can say whatever you like, but it should include the URL from Giphy:
Check out this tutorial for more about how to properly format your Slack message in Zapier.
You can add your image in the Attach Image by URL field, as I’ve done above, or you can pop that URL right into your message. If you put it in the message text field, you’ll see both the URL and the image itself, whereas attaching the image just shows the image.
Now, sit back and get all the inspirational messages you need.
Go create your own "You're Awesome" bot.
Advanced: Make this Zap more weird using Inspirobot
Maybe you're not the AwesomeBot type, and want some extra randomness in your day. Here are some ways you can modify that Zap to instead send you memes from Inspirobot.
Totally AI-generated, it creates "inspirational" messages that are often funny, even if they don’t make a whole lot of sense.
Because this is AI generated, it may not always be totally safe for work. So proceed with caution.
What I like about this tool is it has a very simple API that we can use in our Zap to generate our own Inspirobot messages.
To do this, we’ll use the same foundation as our first Zap—the random day and time steps will stay the same—but replace the Giphy step with a Webhooks by Zapier step. You can do this by clicking the EDIT button that appears when you hover over that step in your Zap editor.
Choose Webhooks by Zapier in the Choose App section, and continue customizing.
We’ll choose the GET option because we want to get information from Inspirobot’s API. This is the URL to use: https://inspirobot.me/api?generate=true
This URL will do all the heavy lifting for us, so we won’t need to fill out anything else in this step. We just throw a call to that URL, and our image link will come back.
Once we have that image, we can add that to our message in our Slack step the same way we did with our Giphy link.
Even more advanced: Customize to celebrate Christmas
Now let’s kick this up another notch…
If we check out the API for Inspirobot, we find a whole other link https://inspirobot.me/api?generate=true&season=xmas
that will give us Christmas-themed images. (And wouldn’t it be cool if there were ones for all the other December holidays!)
We can add this to our workflow in a few different ways. We could create a Zap that runs only in December (using Filter by Zapier) for the themed images and one that runs January through November for the regular images.
Or we can take advantage of our Paths tool and create a Path for December and a Path for the rest of the year.
But if we wanted to keep this workflow in one Zap and without needing a Path or a Filter, we can have a little fun with a Lookup Table, which is another function in our Formatter app. I love this tool, as it works really well as a replacement for Filter and Paths and helps you streamline your Zap.
A lookup table lets you match information coming through a specific field with corresponding detail. So, for example, if the date month is ‘8’ (August), we can match that with the regular API URL, but if it’s ‘12’, we’ll match it with that Christmas URL:
But, I’m all about making things even easier. Let’s set it up so we won’t need to add an item in the table for each month in the year.
To do that, we’re going to use that Fallback Value field. This field lets you set text that will be used if none of the options in the table match. Doing it this way, we can set the URL only if it’s the 12th month, and then all other months will get the Fallback Value URL:
Then we map the output of our table into our GET request, and that’s the URL that will run.
We now have a generated Inspirobot link that suits the current month we can use in our Slack message.
So go ahead and turn that on. And be sure to take those few seconds every few days to appreciate that you are awesome—or to crack up at Inspirobot's nonsense.
from The Zapier Blog https://ift.tt/3gt7esj
- Get link
- X
- Other Apps
Comments
Post a Comment