Skip to content

Instantly share code, notes, and snippets.

@macchky
Created June 14, 2017 15:14
Show Gist options
  • Save macchky/2b4b5652e675a682d29b602431734658 to your computer and use it in GitHub Desktop.
Save macchky/2b4b5652e675a682d29b602431734658 to your computer and use it in GitHub Desktop.
Simple Webhook Tutorial (Twitter -> Discord using IFTTT)

Navigate to: YouTube via IFTTT, Twitter via Zapier, Reddit or GitHub.

WARNING

If you get "Invalid Ingredient" errors, that means IFTTT updated the shit and you need to mess around with the "ingredients" they gave you now.

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. Unlike jagrosh's tutorial, this one uses IFTTT. We all know that Zapier has a 100-request limit (Unless you are extremely rich and you even pay $20 a month or $220 a year) but IFTTT doesn't.

Interested in YouTube to Discord? Click here; it is also mine.

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 or service can post messages to this channel, without even needing to be in the server. Keep it safe! WebhookDiscord

  3. 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. "My recipes"
  2. "Create a recipe"
  3. Press that underlined huge "this".
  4. (Step 1/7) Search for "Twitter" in the "Search channels" box. Click on it. If it needs you to connect Twitter channel (only first time), just click it, log into Twitter, and authorize it.
  5. (Step 2/7) Let's say I choose "New tweet by you".
  6. (Step 3/7) Choose whether to include reply/retweet or not.
  7. Press that underlined huge "that".
  8. (Step 4/7) Search for "Maker" in the "Search channels" box. Click on it. Again, it is called Maker, not "http request" or such thing!
  9. (Step 5/7) You only have 1 choice.
  10. (Step 6/7) Here's the important part.

Step 4 - Setup the webhook

Screen Shot 2016-10-23 at 8.00.52 PM.png

  1. Select "Post" in method, and "application/json" in content type.
  2. Paste your webhook URL in the URL box.
  3. Paste the following stuff. Edit it if you want.

If you want the one when @discordapp first knowing that I am making an IFTTT webhook, use the following (But it does not give you preview of the tweet, means you cannot see the image):

{
    "username" : "IFTTT Twitter Test",
    "avatar_url" : "https://pbs.twimg.com/profile_images/767879603977191425/29zfZY6I_400x400.jpg",
    "embeds": [
        {
            "title" : "{{CreatedAt}}",
            "url" : "{{LinkToTweet}}",
            "author" :
            {
                "name" : "@{{UserName}}",
                "url" : "https://twitter.com/{{UserName}}"
            },
            "description" : "{{Text}}"
        }
    ]
}

No-Preview

Simplier and with preview: (Updated, so it's not text)

{
  "username":"IFTTT Twitter Test",
  "icon_url":"https://pbs.twimg.com/profile_images/767879603977191425/29zfZY6I_400x400.jpg",
  "content":"@{{UserName}} tweeted this at {{CreatedAt}}: {{LinkToTweet}}"
}

With-Preview

Step 5 - Profit

Now what you have to do is just click "Create Action". It will start to run immediately. You can shut it down using the power button. If there's any error, it'll appear in the log. "Check now" button updates the log in case it is not automatically updated (I think).

Note: During my test, it has about 1 minute of delay after you made a tweet. I don't know it's because of frequent tweets or something else.

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