Skip to content

Instantly share code, notes, and snippets.

@DerEnderKeks
Last active December 4, 2023 20:28
Show Gist options
  • Save DerEnderKeks/6448c28f5e32b4b52741fbda4ec34285 to your computer and use it in GitHub Desktop.
Save DerEnderKeks/6448c28f5e32b4b52741fbda4ec34285 to your computer and use it in GitHub Desktop.
Simple Webhook Tutorial (Twitter -> Discord using IFTTT)

Simple Webhook Tutorial

In this tutorial, I will be explaining how to set up a simple webhook to relay your tweets to a Discord channel.

Step 1 - Register on IFTTT

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

Step 2 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send Tweets.

  2. In the settings for that channel, find the Webhooks option and create a new webhook.

Note: Do NOT give this URL out to the public. Anyone can post messages to this channel using it, without even needing to be in the server. Keep it safe!

  1. You can name the webhook whatever you want, and give it any image; for this tutorial we override them later anyway. Keep track of the URL; we'll need it later.

Step 3 - Make an IF recipe

  1. Click on you profile icon in the top right corner
  2. Click on Create
  3. Click on This
  4. Search for Twitter
  5. Click on the Twitter square
  6. Select a trigger like New tweet by you or New tweet by a specific user
  7. Set the options for the selected trigger (depending on which you selected)
  8. Click on That
  9. Search for Webhook
  10. Select the Webhook square
  11. Select the Make a web request action

Step 4 - Setup the webhook

  1. Paste your webhook URL in the URL box.
  2. Select Post in method, and application/json in content type.
  3. Paste the following snippet into the Body field and modify it to your liking. You should at least set the icon_url. (You can add other details like the post time, click the Add ingredient button to see what is available)
{
  "username":"@{{UserName}}",
  "icon_url":"<url to image>",
  "content":"{{LinkToTweet}}"
}

Step 5 - Profit

Now what you have to do is just click Create Action. It will start to run immediately.

@APratham
Copy link

APratham commented Oct 2, 2020

Can we have the bot not consider RTs? It is posting way too many tweets than it should be doing. I had set up the script and when I woke up I had 7 messages on the Discord channel from the bot

@DerEnderKeks
Copy link
Author

@APratham That should be possible by using the New tweet from search trigger, and according to this you could use from:username -filter:nativeretweets as the search query.

@APratham
Copy link

APratham commented Oct 2, 2020

Thank you for this. But now I have to redesign the whole thing and IFTTT has a quota of how many applets you can have on the free account :(

@kmschellens
Copy link

Same problem. Valid JSON, setup according to tutorial. But webhook does not perform the POST.

@MrAureliusR
Copy link

Same problem. Valid JSON, setup according to tutorial. But webhook does not perform the POST.

What is your exact setup?

@kmschellens
Copy link

kmschellens commented Dec 8, 2020

Same problem. Valid JSON, setup according to tutorial. But webhook does not perform the POST.

What is your exact setup?

I've solved the problem, for me, it was not the JSON, it's just that IFTTT is so slow that it could take up to 30 minutes before it decided to call the webhook. I switched to Tasker which solved that problem. I used the same JSON and that worked.

@swolesneakerhead
Copy link

swolesneakerhead commented Dec 9, 2020

image

First time using this, not sure why im getting this error? Can anyone assist?

@MrAureliusR
Copy link

By the way, I found a much much better solution -- Zapier. They have direct integration with Discord via a super simple and easy to use bot. Basically if IFTTT had a discord bot. Highly recommend.

@Wolfkid200444
Copy link

can u do one for twitch

@yasserprogamer
Copy link

thank you! You really help me! Now no need to invite Discord Bots

@PopularMMOsAntnyTheCoolGamer

{
"username":"@{{UserName}}",
"icon_url":"",
"content":"{{LinkToTweet}}"
}

I put this as my body but it said aplet failed

@matrix643
Copy link

I get "Application Failure: Too many requests to this host"

@Nonameboiiscool
Copy link

Hey I also wanted to ping a role while sending it so should I put the <@&roleid> in the last ??

@Nonameboiiscool
Copy link

Hey I also wanted to ping a role while sending it so should I put the <@&roleid> in the last ??

Before the last } ?

@boumer7
Copy link

boumer7 commented May 5, 2021

I get "Application Failure: Too many requests to this host"

Me also

@Gullivr1
Copy link

Gullivr1 commented Jun 7, 2021

How do i add the Text ingredient to this:
{
"username":"@{{UserName}}",
"icon_url":"",
"content":"{{LinkToTweet}}"
}

@pekatour
Copy link

pekatour commented Jun 9, 2021

How do i add the Text ingredient to this:
{
"username":"@{{UserName}}",
"icon_url":"",
"content":"{{LinkToTweet}}"
}

Try something like this :
{
"username":"<<<<>>>>", [don't copy this, just put your a name between the brackets or leave the one from your example]
"avatar_url":"<<<https://awebsite.hoster.picturenamejpg>>>",
"content":"{{Text}}"
}

@Maverrin
Copy link

Hello

I am doing something very simple :

{
 "content": " **New tweet** : {{LinkToTweet}}"
}

However, when there is a integrated link in the tweet, it isn't shown in my discord server. Do you know how to keep integrated link in my discord server?

@iKxzumas
Copy link

How i can add a mention role for ping people?

@mattizhu
Copy link

mattizhu commented Jul 6, 2021

Just to elucidate this issue, IFTTT is having problems regarding rate limiting that Discord has imposed but working with them to find solutions.

https://help.ifttt.com/hc/en-us/articles/1260804901449-Webhooks-to-Discord-may-fail-due-to-rate-limiting-too-many-requests-to-this-host-error-

@Azarora
Copy link

Azarora commented Jul 9, 2021

I want to @everyone in my discord when there is a new tweet in my discord, what should my body in the IFTTT applet look like in this case?

@Cactirocket
Copy link

I did everything right, it isn't working.

@HelloMukama
Copy link

Thanks this worked!

@Ru-Pirie
Copy link

I want to @everyone in my discord when there is a new tweet in my discord, what should my body in the IFTTT applet look like in this case?

when you have the "content" tag add @everyone {{LinkToTweet}} and that should work.

@ShuraKronos
Copy link

Hello, i tried this and got stuck at step 4. I copy the webhook URL from discord, but there is no URL box in IFTTT. There is only a buton that says Connect, and when clicked a mini brower window pops up asking for authorization, and once given, it goes to an error 404.
Screen Shot 2021-08-26 at 9 35 23 PM
Uploading Screen Shot 2021-08-27 at 6.35.10 AM.png…

@Ventil4tor
Copy link

If it doesn't work, check this:

https://ifttt.com/twitter/settings

my Webhook didn't work since months and this was the problem, my account was offline.
click on reconnect and after some minutes it works.

@ShuraKronos
Copy link

Thanks for the reply. It seems my mac was giving the issue. I tried doing the same process on a PC and it worked.

@Krojack
Copy link

Krojack commented Sep 13, 2021

Is it possible to use the "New tweet by a specific user" and also include "with a hashtag"? I want to watch tweets from a user that also include a hashtag. I don't want all tweets from that user.

Even better would be if I could regex match text in the tweet message, or both hashtag and tweet message matching to narrow down.

@MULTidll
Copy link

MULTidll commented Sep 25, 2021

Screenshot 2021-09-25 112540

Can anyone help me with this i used this body { "username":"MULTi", "avatar_url":"AVATAR-LINK", "content":"@{{UserName}} tweeted this at {{CreatedAt}}: {{LinkToTweet}}" }
but yestarday 24/9/2021 it was working

@iSyad
Copy link

iSyad commented Sep 27, 2021

Can anyone help me with my problem. Why does my LinkToTweet doesnt work as it should.. I mean like it before this it works fine but after a few days my discord bot sent the tweet but without the link.

image_2021-09-27_093746

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