Menu

Help Center

Intro to Webhooks

Follow

Comments

62 comments

  • Avatar
    sigoshi

    So for the people who have no idea what webhooks are still or how they can use them for whatever they want without having to rig up a whole custom tube-shoomping system, there is a way to connect discord to... well, anything! This method will allow you to make a custom webhook, perhaps to integrate a non-hookable app (like social media) to your discord (such as posting a message every time you upload a youtube video).

    The website IFTTT.com is a system that will allow this sort of cross-integration. IFTTT (If This, Then That) is a simple online platform to make cloud-connected services intercompatible. It works using "channels" for different services, and while discord doesn't have an official channel, you can use the "Maker" channel to post messages through

    As an example, here's how to make a discord webhook post automatically when you upload a youtube video

    1. Create an IFTTT account, and connect it to the "gmail" or the "youtube" channel (or whatever channel is compatible with the service you want to use, such as Tumblr, Twitter, your android phone, your... dishwasher?). Theres a list of available channels here.

    2. Create a new recipe, selecting your "trigger" channel as youtube (again, substitute your choice here).
    3. You'll now get the option to choose your trigger. the triggers are the different actions in each channel that can activate your IFTTT recipe. For this case, select "When a new public video is posted". Depending on your trigger channel, it can be anything from "when a new blog post is made" to "when your phone leaves a certain area"
    4. Now you fill out any trigger fields. Certain trigger channels use input information to run more specifically. This will depend on what channel you chose. Youtube doesn't need anything more than the channel info you gave when you connected it.
    5. Now, you select your action channel. This is the channel that actually does stuff. For Discord, we'll use the "Maker" channel, which will be the fishing rod that casts your webhook.
    6. The Maker channel has only one action- making a web request. That's exactly the one we need.
    7. Now, you fill out the more specific information for Maker. This is gonna be details regarding your webhook and what you want it to do. Create a webhook in discord following the instructions above, and copy the webhook's url to Maker's URL field. For the method, select POST (webhooks currently aren't able to do much else... as far as i know.), and for the content type, select "application/json" (it might be compatible with other options, but i haven't really tested.)
    8. Finally, you will write the content you want the webhook to post. The format in which you write the message is in JSON, with a message being as follows:
      • { "content" : "<the message you want to post goes in these quotes>" }
    9. You can use input data from whatever trigger recipe you selected. To do so, click on the little beaker button in the text field, and select the data you want to use. make sure it's inside the second set of quotes, or it won't do anything (or worse, do something that throws an error!)
    10. Click "Create action", and your automated poster will be ready to go! give it a title and click "create recipe" to save it!

    When all is said and done, your webhook will start running on its own. Whenever your trigger action actually occurs, it will go through and post whatever you've set it to!

    If you want to test a webhook through IFTT without having to upload a bunch of fake youtube videos and piss off your subscribers, download their "DO button" app on your phone. This will allow you to perform IFTTT actions where the trigger is just pressing a button on your phone. 

    For those who want to do a little more than just post messages through their webhook (and have an understanding of how to build the JSON payload), you can use the webhook part of Discord's API to learn what else your webhooks can do (different usernames, using TTS, etc.) I also suggest that anyone using this method look into what other options are available in IFTTT. Some possibilities include posting a panic message with your location through a phone widget, a TTS announcement for when your dinner's done cooking while you're in-game (provided you have a smart-oven), and much much more.

    Tube shoompers aren't just for the development inclined anymore! Through IFTTT, you can use more hooks than a laggy Roadhog! Speaking of which, back to the solo queue for me. Go ahead and post any questions here if you have any issues, and I'll try to help as best as i can.

    Have fun!

  • Avatar
    peeweejd

    I made a webhook for our server.  I have a test server I made and the code works as intended.  On my real server it does not work.  We have some permissions set up on the server (the default permissions dont allow chat).  Is there a way to set permissions for a webhook bot?  I know they are not supposed to be bots.

  • Avatar
    cbpudding

    I wonder if the Discord team will ever create outgoing webhooks for things like bots.

  • Avatar
    peeweejd

    @breadpudding that would be sweet. It would make otherwise simple tasks sooooo much easier.

  • Avatar
    seb_test

    Hey Howl,

     

    How are you able to change the avatar the GitHub webhook uses? Is it a special feature? The webhook customization seems awfully limited on my side

  • Avatar
    peeweejd

    I was just able to change the avatar on mine on the same screen you get the URL.  You can change the name and set the avatar.

  • Avatar
    seb_test

    You can indeed change the avatar and name of the webhook on Discord, but they are overridden by the GitHub avatar and name

  • Avatar
    Howl

    @seb_test - Hey, the one I was talking about in my post isn't GitHub. It's [Gogs](https://gogs.io/).

  • Avatar
    AyCraft (AyScorch)

    What are all the webhook supported websites?

     

  • Avatar
    FaSciCake (Edited )

    oh yeah, Mr. Krabs..

  • Avatar
    peeweejd (Edited )

    Has anyone had any luck tagging users or groups in these messages?  I'm not using github, i'm using a custom PHP script to announce upcoming events and who has signed up for them.  It would be nice to be able to tag the people as a reminder.

    I have the user's name and discriminator (example peeweejd#1324).

    We tried adding @ to the beginning but it seems the data from the webhook does not go through the same logic that user's manually input stuff does.

    edit: if it matters, the data is sent to discord as post data using the PHP command "curl_exec"

  • Avatar
    rce (Edited )

    @peeweejd

    I believe you can include `<@userid>` in message content to mention users e.g. `<@141649488069656576>` shows as highlighted `@rce` to me.

  • Avatar
    connor

    this is not working

  • Avatar
    Christian

    Does anyone know how to use this on a wordpress site?

     

  • Avatar
    Foenix

    Zapier is not free.

    IFTTT doesn't work for me. I have a simple rss feed and when I use maker nothing post through webhook in discord.

  • Avatar
    Chilace (Edited )

    @Foenix, test your maker here RequestBin 

    Don't include substitution variables in request that can contain html-content, e.g. {{EntryContent}}

    Example:

    {"content":"@here **New item from {{EntryAuthor}}:** {{EntryUrl}}"}

     

  • Avatar
    Ýz

    How about the other direction? I would love to be able to read a news channel out of our Discord server and post it to an RSS or JSON feed for our guild website. Has anyone been able to do this?

  • Avatar
    King - Vlad

    If only we had Travis Support.. Or we do and I'm just dumb

  • Avatar
    wyrmling

    Hey, so I can't figure out how to get this working with Beanstalk's modular webhooks. Any advice? I've tried appending /slack to no avail.

  • Avatar
    Demozo

    Any plans to add BitBucket support?

  • Avatar
    ~/l4p1n.sh

    Is there any kind of support for Gogs webhooks ? I know I can build a simple PHP script but it'd be a time saver if I can use what exists. So if there's a support, what do I append to the end of the URL ?

  • Avatar
    Saucey

    Do these webhooks work on Twitter? ):

  • Avatar
    Drakas

    If you open sourced the code for github and slack integrations, I'm sure others would be more than happy to introduce new integrations alongside the existing ones to grow your platform. :-)

  • Avatar
    looter

    This is great, but the github receiver for the webhook doesn't parse the \n github provides properly, so if you format your commits nicely it only displays the first line.

  • Avatar
    An Duong

    Hi, i cannot post message to webhook when using curl on Windows. It works fine from Linux

    The error message is  {"code": 50006, "message": "Cannot send an empty message"}

    any ideas?

    Thanks,

    AN

  • Avatar
    Tarmo

    Waiting for a Bitbucket solution on this one. Bitbucket supports Webhooks but it seems I cannot get any messages through out of the box even with the previous solutions like adding '/github', '/bitbucket', '/git' or even '/slack' at the end of the URL when configuring the payload URL in Bitbucket.

  • Avatar
    Keril Artemov

    Is there any solution to multi-commit push notification title only leading to the last commit?

    Example:

    [crumbling-island-arena:master] 14 new commits

    That's where notification link leads

    Actual link should be this

    https://github.com/DoctorGester/crumbling-island-arena/compare/cc06d851f4e9...e4ce8e3e56fd

  • Avatar
    TheProGamer

    ok I need help for webhooks but where do I get my general URL? I understand I choose #general but what happened after that? WHERE IS THE REPO SETTINGS

  • Avatar
    Hog Rider Supercell

    how do i set up a webhook on circleci?

  • Avatar
    [GOCLW]GeorgeOnsiAlfy

    Still can't do it what is repo ?

Article is closed for comments.