Development

Connect a YouTube playlist feed to Discord with IFTTT

 
 

If your home is anything like mine, Brad Leone, Claire Saffitz, and the rest of the Bon Appétit Test Kitchen are household names. My fiancée and I itch for new episodes of It’s Alive and Gourmet Makes during the week. This led to me researching notification methods for new episodes, specifically via Discord (since Discord is how we communicate throughout the day.)

After some research, I settled on IFTTT and Discord’s built-in webhooks. If you’re not familiar with IFTTT, it’s a service that allows apps and devices to connect via “applets.” Applets detect changes between services, and webhooks… Well, webhooks are magic. Plain and simple.

Now that we’re practicing the dark arts, here’s the proposed flow:

New video > IFTTT applet > Discord webhook > Post to Discord channel

However, I quickly hit my first snag when I realized Bon Appétit categorized their shows into individual playlists (IFTTT doesn’t have an an applet specifically for YouTube playlists.) A few Google searches later, and I was able to find a solution — grabbing the playlist’s feed URL. IFTTT supports RSS feed services, which is exactly what YouTube’s feed URL provides.

Now that we know this, here’s how to do it.


Grab the RSS feed for a YouTube playlist

1. Go to the playlist homepage, and copy the playlist ID from the end of the URL.

The ID is the final string of numbers and letters following “?list=”

The ID is the final string of numbers and letters following “?list=”

2. Paste the playlist ID at the end of this URL: https://www.youtube.com/feeds/videos.xml?playlist_id=

You should now see a feed that looks like this.

3. Copy this URL, you’ll need it when we create our IFTTT applet.


Create a Discord webhook

1. Go to the channel you’d like to create the webhook, and click the gear icon to edit the channel settings.

discord-edit-channel

2. Select “Webhooks” from the menu to the left, then click “Create Webhook”.

discord-create-webhook

3. Give your webhook a name, and select the channel to post a message.
You can also upload an image for your bot here. This will show up as the bot’s icon when it posts to the channel.

4. Copy the webhook URL and keep it handy. You’ll need this in a few steps.

5. Click “Save”.


Create an IFTTT applet

1. Click “Explore”, then click “Create”.

2. Click the “+this” to add a service.

ifttt-this

3. Search for “RSS”, and select the “New feed item” trigger.

4. Paste the YouTube feed URL you copied earlier into the “Feed URL” field.

ifttt-feed-url

5. Click “Create Trigger”.

6. You should now see something like this:

ifttt-that

7. Click the “+that” to add an action service.

8. Search for “webhooks”, and select the “Make a web request” trigger.

9. Paste the webhook URL you created earlier in the “URL” field.

10. Choose “Post” for the Method.

11. Choose “application/json” for the Content Type.

12. Copy and paste this JSON code into the “Body” field.

{ "content": "There's a new **{{FeedTitle}}** episode!", "embeds": [ { "title": "{{EntryTitle}}", "description": "{{EntryContent}}", "url": "{{EntryUrl}}" }] }

13. Click “Save”.


That’s it! Whenever there’s a new upload to the YouTube playlist, the feed will update, IFTTT will work make some calls, and you’ll see a message in the Discord channel you selected. Magic, right?