Using IFTTT to Create a Discord Bot

Victor Scholz
5 min readDec 28, 2020

--

If This Then That (IFTTT) is a powerful web-based tool that allows users to create chains of conditional statements that are trigged by changes in other web services. For example, maybe you want to get a text reminder every time you respond to a Google Calendar invite. Or maybe you want to get a phone notification if there is rain forecasted for tomorrow. Both of these examples are just barely scratching the surface of what IFTTT can do, and honestly the possibilities are endless. The sheer volume of web services and applications out there can be overwhelming, so simply put, IFTTT provides a bit of automation for you.

In my Discord server we needed a bot to automate the reminder for Stand Up every weekday morning at 10am and for Stand Down every weekday afternoon at 5pm. Now, there are bots out there that integrate with Discord at the click of a button but none of them really provided the exact type of customization I was looking for. I could have them post a message with a Zoom link every 24 hours but I couldn’t specify the time or the day. This is where IFTTT and the server integrations tab of Discord come in.

The first thing you want to do is go to your server settings and on the left side click on “Integrations”.

To create a new integration in Discord you have to either be the server owner or have administrative privileges.

From there you want to click on “Webhooks” and you will be greeted with a page that allows you to create a new one.

Creating a new webhook and naming your bot.

Once you click on “New Webhook”, you’re able to change the name of your bot and specify the channel that it’ll post in. What you want to do now is click on “Copy Webhook URL”. This is what you will be pasting in your new applet in IFTTT. One quick note: this URL should be kept private as this is a direct link to your server.

Go on over to your IFTTT profile and click on “Create” to get started with your custom applet.

The Nav bar for your IFTTT profile

This is the page you’ll be greeted with after clicking on “Create”. The first step in getting your applet to work is to make a trigger. In other words, what will your applet be looking for that will cause it to run. Go ahead and click on “Add”.

In my specific situation, I needed an applet that fired at a specific time on specific days so I searched for “Date & Time”.

From here, you want to select an option that aligns with what you’re looking for. I chose “Every day of the week at” because it allowed me to specify the exact days of the week and a time.

After you create this trigger you’ll be taken back to the main applet screen.

The next step is to specify what will happen when the applet runs. Go ahead and click on “Add” and, for a Discord integration, you’ll need to search for “Webhooks”.

In the “URL” section, you’ll paste in the Webhook URL you copied from your Discord server. To get your bot to post a message you’ll need to select “POST” and “application/json”. The tricky part is formatting the body of your message properly. In a perfect world you could just quickly type in your message and call it a day. Unfortunately it won’t work unless it’s proper JSON. A sample of what that would look like is below:

Clicking on “Add Ingredient” will allow you to customize the message a bit more. I chose {{DayOfWeek}} so that the bot will say what day it is each time it’s triggered.

After that all you need to do is save it! From there you’ll be taken back to the home screen where you can see your applet. When your specified time comes, it will trigger and your bot will post in your server.

If you want to have a second message sent in your server at a different time, you’ll need to create another applet for that. The reason for this is that there can only be one trigger for any given applet on IFTTT.

There you have it! A relatively simple way to automate message posting in your Discord server. This is only for one small example of a bot being triggered at a specific time during the week, but there are dozens of other options. I urge you to explore what IFTTT has to offer to see if there are any other ways to automate certain tasks in your life.

--

--

Victor Scholz
Victor Scholz

Written by Victor Scholz

Full Stack Developer | React | JavaScript | Ruby on Rails

No responses yet