Skip to content

Instantly share code, notes, and snippets.

@smiley
Last active Oct 19, 2021
Embed
What would you like to do?
How to make an automatic "stream's live" notification for your Discord server

Making an automatic Twitch -> Discord notification (using IFTTT)

So you went live and you want everyone to know. Here's how you do it:

Part 1 - Register on IFTTT

Go to https://ifttt.com/ and create an account (if you don't already have one)

Part 2 - Make a Discord Webhook

  • Find the Discord channel in which you would like to send Tweets.
  • In the settings for that channel, find the Webhooks option and create a new webhook. Note: This URL should be kept private. It allows anyone to write messages to that specific channel using that specific URL. Keep it safe! WebhookDiscord
  • Name the webhook however you like and feel free to change the generic profile picture. I chose this icon as it fits the circle nicely.
  • Copy the URL somewhere and keep it handy for the next step.

Part 3 - Create a new IFTTT applet/recipe

  1. Go here to create a new "Applet"
  2. Click the big blue "[+] This" and choose "Twitch" (use the search bar to find it quickly)
  3. Connect your account if necessary.
  4. Choose "New stream started by you" (it should be the 2nd option from the left)
  5. Click the big blue "[+] That" and choose "Webhooks"
  6. Choose "Make a web request" (it should be the only option)
  7. Fill in the following details:

    URL: [your URL from "part 2" above] Method: POST Content type: application/json Body: [see the snippet below]

  8. Click "Create Action"
  9. Done!

Snippet for "Body"

Webhooks are super-customizable and allow you to make pretty well-detailed visuals. However, their format is also somewhat complex to get right without extensive testing, so here's a template which would be useful to most people:

{
  "content": "{{ChannelName}} went live on Twitch",
  "embeds": [{
    "title": "{{ChannelUrl}}",
    "url": "{{ChannelUrl}}",
    "color": 6570404,
    "footer": {
      "text": "{{CreatedAt}}"
    },
    "image": {
      "url": "{{StreamPreview}}"
    },
    "author": {
      "name": "{{ChannelName}} is now streaming"
    },
    "fields": [
      {
        "name": "Playing",
        "value": "{{Game}}",
        "inline": true
      },
      {
        "name": "Started at (streamer timezone)",
        "value": "{{CreatedAt}}",
        "inline": true
      }
    ]
  }]
}

This snippet produces this snippet: (for the channel "xQcow"): Example using xQcow's channel

Custom message

If you'd like to customize the message text -- "xqcow has gone live on Twitch!" -- change the content attribute:

{
  "content": "{{ChannelName}} has gone live on Twitch!",
  "embeds": [{

Show your Twitch profile picture in the embed (advanced)

If you'd like to show your Twitch profile picture in the box:

  1. Go to Twitch
  2. Right-click your profile picture in the top-right:

User area on Twitch.tv

  1. Click "Copy image address"
  2. Paste that address into this blob instead of <IMAGE_URL>:
"thumbnail": {
  "url": "<IMAGE_URL>"
},
  1. Paste that blob below the image area in the main blob, so that part would change from this:
    "footer": {
      "text": "{{CreatedAt}}"
    },
    "image": {
      "url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_{{ChannelName}}-1280x720.jpg"
    },
    "author": {
      "name": "{{ChannelName}} is now streaming!"
    },

To this:

    "footer": {
      "text": "{{CreatedAt}}"
    },
    "image": {
      "url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_{{ChannelName}}-1280x720.jpg"
    },
    "thumbnail": {
      "url": "<IMAGE_URL>"
    },
    "author": {
      "name": "{{ChannelName}} is now streaming!"
    },

Note: The image address you just used for your Twitch profile picture may stop working if you change your picture. I'm not sure how Twitch manages those.

Credits

@chuckreynolds

This comment has been minimized.

Copy link

@chuckreynolds chuckreynolds commented Aug 23, 2018

fwiw this embed tester tool REALLY helped https://leovoel.github.io/embed-visualizer/

@chuckreynolds

This comment has been minimized.

Copy link

@chuckreynolds chuckreynolds commented Aug 23, 2018

My issue with the

"image": {
      "url": "{{StreamPreview}}"
    },

is when the channel goes live twitch always sends the 404 image because it fires too fast to get an image from the stream. I've ended up just removing it.

@VideoGamer54321

This comment has been minimized.

Copy link

@VideoGamer54321 VideoGamer54321 commented Aug 23, 2018

How do you add the title of the stream to the Webhook?

@NighterNyx

This comment has been minimized.

Copy link

@NighterNyx NighterNyx commented Sep 16, 2018

Did anyone know how to fix the stream preview image? It's only show twitch logo.

@AlexWayfer

This comment has been minimized.

Copy link

@AlexWayfer AlexWayfer commented Dec 5, 2018

This guide was adapted from this [YouTube to Discord via IFTTT guide]().

Where is the link?

@wickham

This comment has been minimized.

Copy link

@wickham wickham commented Jan 20, 2019

Did anyone know how to fix the stream preview image? It's only show twitch logo.

Change:
"image": { "url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_{{ChannelName}}-1280x720.jpg"},
to:
"image": { "url": "{{StreamPreview}}"},

this will make your image preview work again

@Ammax

This comment has been minimized.

Copy link

@Ammax Ammax commented Jan 30, 2019

How can i display Stream titel ? and the titel be klickabel as link for the channel?

@CruelDaemonLP

This comment has been minimized.

Copy link

@CruelDaemonLP CruelDaemonLP commented Feb 22, 2019

How can i display Stream titel ? and the titel be klickabel as link for the channel?

How do can display Stream Title, i would it know too, but the code for click the link with random text should be
[LINK TEXT](URL or {{ChannelUrl}})

@smiley

This comment has been minimized.

Copy link
Owner Author

@smiley smiley commented Mar 9, 2019

@AlexWayfer

This guide was adapted from this [YouTube to Discord via IFTTT guide]().

Where is the link?

Fixed, looks like I forgot to paste it.

@wickham

Did anyone know how to fix the stream preview image? It's only show twitch logo.

Change:
"image": { "url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_{{ChannelName}}-1280x720.jpg"},
to:
"image": { "url": "{{StreamPreview}}"},

this will make your image preview work again

Thanks. I think {{StreamPreview}} didn't exist at the time, or malfunctioned, hence the workaround.

@VideoGamer54321 @Ammax @CruelDaemonLP

How do you add the title of the stream to the Webhook?

How can i display Stream titel ? and the titel be klickabel as link for the channel?

How do can display Stream Title, i would it know too, but the code for click the link with random text should be
[LINK TEXT](URL or {{ChannelUrl}})

IFTTT doesn't expose stream titles, so that can't be embedded. IFTTT also doesn't let you query anything while the applet/hook is running, so to add anything dynamic that isn't available -- like a stream title -- you'd have to find an entirely different site.

@jowy99

This comment has been minimized.

Copy link

@jowy99 jowy99 commented May 15, 2019

Why it doesn't work? It worked 4 times and now it doesn't work....

@ethanopp

This comment has been minimized.

Copy link

@ethanopp ethanopp commented Jun 15, 2019

Thanks for this repo!

Is the "image": { "url": "{{StreamPreview}}"} currently working? ...I'm still just getting the twitch logo

@Outstyling

This comment has been minimized.

Copy link

@Outstyling Outstyling commented Dec 7, 2019

mine isn't doing anything

@lymetree

This comment has been minimized.

Copy link

@lymetree lymetree commented Dec 11, 2019

"name": "Started at (streamer timezone)",
"value": "{{CreatedAt}}",

Is there a way for it to show as a different time for users who live in different time zones? For example, the message shows up in EST for everyone but some people live in CST and I want it to change to that time for CST but keep it the same for EST people.

@smiley

This comment has been minimized.

Copy link
Owner Author

@smiley smiley commented Dec 11, 2019

@lymetree
No, it's part of the message text and doesn't change like message timestamps. But the message's own posted timestamp will be roughly close, so there's no real need to match this.

@CristopherDiazRuiz

This comment has been minimized.

Copy link

@CristopherDiazRuiz CristopherDiazRuiz commented Feb 26, 2020

dont work :(

@MowerSky

This comment has been minimized.

Copy link

@MowerSky MowerSky commented Mar 7, 2020

dont work in 2020

@DirectorQuokka

This comment has been minimized.

Copy link

@DirectorQuokka DirectorQuokka commented Apr 3, 2020

It does work in 2020 BTW. I just used it. This is superb work! Ever since CouchBot went patron (private), I've been searching for a way to fully customise an embed, that announces the streams of Twitch channels! I'll be honest, I'm very much new to this, and spent the whole day messing around, and doing trial and error to make the embed look like I want it to. In the end, a product, that is free, and looks amazing. The only thing I'd say, is the the 4 minute delay, is something to note, but is completely worth it!

Thank you so much for posting this tutorial! :D

@MarkaTossa

This comment has been minimized.

Copy link

@MarkaTossa MarkaTossa commented Apr 17, 2020

i wrote an simple one which is what everyone needs i guess

{
"content": "@everyone\n{{ChannelName}} went live on twitch!\n{{ChannelUrl}}"
}

@brewercrain

This comment has been minimized.

Copy link

@brewercrain brewercrain commented Apr 27, 2020

@smiley
do the ingredients need to have their content escaped with <<>>?

@smiley

This comment has been minimized.

Copy link
Owner Author

@smiley smiley commented Apr 27, 2020

@brewercrain No, what are you trying to escape?

@FuabrV11

This comment has been minimized.

Copy link

@FuabrV11 FuabrV11 commented May 4, 2020

@smiley
I really like how this looks and I want to use it but I keep getting this notification when it tries to run it, "Unable to make web request. Your server returned a 400". Do you have any recommendations on how to fix it?

@Don-Kastor

This comment has been minimized.

Copy link

@Don-Kastor Don-Kastor commented May 14, 2020

How can I put the title of the stream?

@smiley

This comment has been minimized.

Copy link
Owner Author

@smiley smiley commented May 14, 2020

@Don-Kastor

How can I put the title of the stream?

You can't, IFTTT doesn't have an attribute for stream title.

@Faculty1989

This comment has been minimized.

Copy link

@Faculty1989 Faculty1989 commented May 19, 2020

It worked the first time, but then after starting another stream, my "stream_BOT" wouldn't post again. And now it doesn't work at all. Does anyone know what's the problem there?

@wurtz

This comment has been minimized.

Copy link

@wurtz wurtz commented Jun 8, 2020

Has anyone else noticed a delay on this? Some days it fires ASAP (it will always take 5 mins). Other days it can take up to 45mins to an hr.

@Suffix11

This comment has been minimized.

Copy link

@Suffix11 Suffix11 commented Jun 19, 2020

I have seen a delay of EXACTLY 39 minutes for the last few weeks.
I don't get it.

@JudgePredator

This comment has been minimized.

Copy link

@JudgePredator JudgePredator commented Jun 23, 2020

There is a delay and sometimes the Applet doesnt trigger at all. Same thing happens with my Twitter Trigger. Checking the activity I get "There was a problem with the trigger."
Opera Snapshot_2020-06-23_032942_ifttt com
But if I click CHECK NOW the applet suddenly works. I do not understand what is going on.
Opera Snapshot_2020-06-23_033047_ifttt com

I also used <<< >>> instead of {{}} because I was getting Error 400.

@gothicserpent

This comment has been minimized.

Copy link

@gothicserpent gothicserpent commented Jul 1, 2020

I have seen a delay of EXACTLY 39 minutes for the last few weeks.
I don't get it.

i tested it 7/1/2020. takes ~5 mins for me. could be an intermittency issue with ifttt server

@gothicserpent

This comment has been minimized.

Copy link

@gothicserpent gothicserpent commented Jul 1, 2020

I also used <<< >>> instead of {{}} because I was getting Error 400.

{{ }} must be used. it works for me using the standard discord webhooks. copy the body as seen exactly in the example.

if it still doesn't work, you may need to delete and re-create the connection on ifttt, and then disconnect the twitch account on twitch.tv and reconnect it from ifttt; should work then after a refresh. i had to to this once.

I also noticed that only if i stream for about 5-10 minutes or more does the "Game" tag get populated. so if you are testing, try to leave the test stream on for about 10 minutes and await the discord notify before you chalk it up as a false positive. just some info there.

@JoK1ngg

This comment has been minimized.

Copy link

@JoK1ngg JoK1ngg commented Aug 9, 2020

What are valid inputs for "name": "Started at (streamer timezone)", ?

@smiley

This comment has been minimized.

Copy link
Owner Author

@smiley smiley commented Aug 9, 2020

@JoK1ngg

That's a field definition, "name" is the name of that field and "value" is, well, its value. (check the screenshot)

@JoK1ngg

This comment has been minimized.

Copy link

@JoK1ngg JoK1ngg commented Aug 9, 2020

Thats not what I meant. What can i put there if I am from Europe. I didnt find anything that works. Im looking for a replacement for "streamer timezone".

@smiley

This comment has been minimized.

Copy link
Owner Author

@smiley smiley commented Aug 9, 2020

@JoK1ngg

That's not input, it's part of the actual text. I added it because the time shown doesn't adapt to the user's timezone (unlike Discord message timestamps) but is instead controlled by the IFTTT account's set timezone.

@NiftyRascal

This comment has been minimized.

Copy link

@NiftyRascal NiftyRascal commented Sep 9, 2020

image

Sadly this solution just doesn't work quickly enough. Does anyone else have a bot which you can use a custom name with that will announce stream go live with a few minutes?

@dhatwalia

This comment has been minimized.

Copy link

@dhatwalia dhatwalia commented Sep 28, 2020

This definitely worked for me on the first try, even adding the stream preview into the code. So this 100% does work as of Sept 2020. However, I am definitely seeing the same issue that others have noted, which is that the post isnt happening in Discord for 30+ mins. Has anyone found a fix to this? Otherwise, still very much loving it!

30 min delay might be due to IFTTT. Perhaps purchasing Pro will solve it.

@xCrimsonRain66x

This comment has been minimized.

Copy link

@xCrimsonRain66x xCrimsonRain66x commented Oct 4, 2020

Mine works wonderfully. Thank you for the tutorial! My only issue is that it only gives me a select few of the pages that I follow to choose from when making the notifications. How do I include those who aren't showing up on the list?

@xCrimsonRain66x

This comment has been minimized.

Copy link

@xCrimsonRain66x xCrimsonRain66x commented Oct 4, 2020

This definitely worked for me on the first try, even adding the stream preview into the code. So this 100% does work as of Sept 2020. However, I am definitely seeing the same issue that others have noted, which is that the post isnt happening in Discord for 30+ mins. Has anyone found a fix to this? Otherwise, still very much loving it!

30 min delay might be due to IFTTT. Perhaps purchasing Pro will solve it.

I purchased Pro, and there is still a delay.

@dhatwalia

This comment has been minimized.

Copy link

@dhatwalia dhatwalia commented Oct 5, 2020

This definitely worked for me on the first try, even adding the stream preview into the code. So this 100% does work as of Sept 2020. However, I am definitely seeing the same issue that others have noted, which is that the post isnt happening in Discord for 30+ mins. Has anyone found a fix to this? Otherwise, still very much loving it!

30 min delay might be due to IFTTT. Perhaps purchasing Pro will solve it.

I purchased Pro, and there is still a delay.

You can expect up to 5 min delay with Pro.

@FakeAardvark199

This comment has been minimized.

Copy link

@FakeAardvark199 FakeAardvark199 commented Oct 12, 2020

How do you add the title of the stream to the Webhook?

I was wondering that as well I'm trying to copy how mee6 does the alerts but do it myself without having to pay for mee6 premium so I can help advertise my friends in my server

@dhatwalia

This comment has been minimized.

Copy link

@dhatwalia dhatwalia commented Oct 12, 2020

How do you add the title of the stream to the Webhook?

I was wondering that as well I'm trying to copy how mee6 does the alerts but do it myself without having to pay for mee6 premium so I can help advertise my friends in my server

Screenshot 2020-10-12 113531

These are the list of available ingredients. At the time of writing this comment, it is not possible.

@pokertrojangaming

This comment has been minimized.

Copy link

@pokertrojangaming pokertrojangaming commented Dec 19, 2020

Hi,

I have this working and has been since set up but I am finding that the stream preview is always the same. Is this just a bug or do I need to change something? Do I need to change or add a standardised preview as when I stream different games it is just the same image on all streams.

@DeFlanko

This comment has been minimized.

Copy link

@DeFlanko DeFlanko commented Jan 4, 2021

Thanks for this repo!

Is the "image": { "url": "{{StreamPreview}}"} currently working? ...I'm still just getting the twitch logo

its 2021 and I too am experiencing this no image preview issue.

@smiley

This comment has been minimized.

Copy link
Owner Author

@smiley smiley commented Jan 4, 2021

Thanks for this repo!
Is the "image": { "url": "{{StreamPreview}}"} currently working? ...I'm still just getting the twitch logo

its 2021 and I too am experiencing this no image preview issue.

There's nothing we can do about that, it's entirely on Twitch's end. If you scroll up you'll see even the direct URL I tried before is just the basic Twitch logo default preview. If you find a better URL to replace that feel free to suggest it. But generally this entire thing isn't that good anymore since IFTTT introduced applet limits.

@mehdifilban-official

This comment has been minimized.

Copy link

@mehdifilban-official mehdifilban-official commented Jan 18, 2021

Hi
I did all the setup but when I'm live I will not get any on my discord channel.
Applet is connected.
But it doesn't work.

@DeFlanko

This comment has been minimized.

Copy link

@DeFlanko DeFlanko commented Jan 19, 2021

@quilir

This comment has been minimized.

Copy link

@quilir quilir commented Mar 11, 2021

It works only 2/3 times. It can choke so badly that it does not send notification even after repeated refreshing, archive/restore, creating the whole new snippet. Not recommended

@uKCooki3

This comment has been minimized.

Copy link

@uKCooki3 uKCooki3 commented May 3, 2021

Does this still work?

@svalencia014

This comment has been minimized.

Copy link

@svalencia014 svalencia014 commented May 30, 2021

Is there anyway to ping a role with the Webhook. I have a role in my discord server called @Twitch Notifs where when people get the role, I would ping them so only people who wanted the pings would get them.

@ThePaulAdams

This comment has been minimized.

Copy link

@ThePaulAdams ThePaulAdams commented Jun 25, 2021

Is there anyway to ping a role with the Webhook. I have a role in my discord server called @Twitch Notifs where when people get the role, I would ping them so only people who wanted the pings would get them.

Right click on the role and Copy the ID, then in the message use <#0> replacing the zero's with the role Id that you coppied.

@DeFlanko

This comment has been minimized.

Copy link

@DeFlanko DeFlanko commented Jun 25, 2021

@Grizzly1987

This comment has been minimized.

Copy link

@Grizzly1987 Grizzly1987 commented Oct 19, 2021

Hello, thank you very much for this great tutorial;). But I have one more question. Is there a possibility to include a query? The following procedure. On our Discord server there is the role @streamer, everyone who has this role is linked to his or her Twitch channel in our bot. Now the bot should only write in the channel (live status) if this streamer only plays a certain game (from our GTA RP server). If he plays other games, no live notification should be posted. Warm greetings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment