Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to use Discord Webhooks

New and currently maintained version

Discord Webhook

It's a JSON

If you don't know anything about JSON, please, spend some time on learning JSON structure.

Recommended sources:

Structure of Webhooks

Before using Webhooks you have to know the structure. All elements listed here are optional but you still need to use the content or embeds object at least once. This is the minimal requirement.

`element` : `[data type]` - description

[string] - text. Supports Markdown Syntax
[url of image] - just a link. Example: `http://www.w3schools.com/html/pic_mountain.jpg`
[url of website] - link too. Example: `http://www.google.com/`
[array] - comma-separated elements. Example: [{"color":15424},{"color":56133}]
[number] - just a number. Example: 555555, duh...
[bool] - boolean... Can be true or false only. Example: "inline" : true
[object] - something you don't need to worry about
  • username : [string] - if used, it overrides the default username of the webhook
  • avatar_url : [url of image] - if used, it overrides the default avatar of the webhook
  • content : [string] - simple message, the message contains (up to 2000 characters)
  • embeds : [array] - array of embed objects. That means, you can use more than one in the same body
    • author : [object] - embed author object
      • name : [string] - name of author
      • url : [url of website] - url of author. If name was used, it becomes a hyperlink
      • icon_url : [url of image] - url of author icon
    • title : [string] - title of embed
    • url : [url of website] - url of embed. If title was used, it becomes hyperlink
    • description : [string] - description text
    • color : [number] - color code of the embed. You have to use Decimal numeral system, not Hexadecimal. Use color picker and converter
    • fields : [array] - array of embed field objects
      • name : [string] - name of the field
      • value : [string] - value of the field
      • inline : [bool] - if true, fields will be displayed in same line, but there can only be 3 max in same line or 2 max if you used thumbnail
    • thumbnail : [object] - embed thumbnail object
      • url : [url of image] - url of thumbnail
    • image : [object] - embed image object
      • url : [url of image] - url of image
    • footer : [object] - embed footer object
      • text : [string] - footer text, doesn't support Markdown
      • icon_url : [url of image] - url of footer icon

Example for a webhook

{
  "username": "Webhook",
  "avatar_url": "https://i.imgur.com/4M34hi2.png",
  "content": "Text message. Up to 2000 characters.",
  "embeds": [
    {
      "author": {
        "name": "Birdie♫",
        "url": "https://www.reddit.com/r/cats/",
        "icon_url": "https://i.imgur.com/R66g1Pe.jpg"
      },
      "title": "Title",
      "url": "https://google.com/",
      "description": "Text message. You can use Markdown here. *Italic* **bold** __underline__ ~~strikeout~~ [hyperlink](https://google.com) `code`",
      "color": 15258703,
      "fields": [
        {
          "name": "Text",
          "value": "More text",
          "inline": true
        },
        {
          "name": "Even more text",
          "value": "Yup",
          "inline": true
        },
        {
          "name": "Use `\"inline\": true` parameter, if you want to display fields in the same line.",
          "value": "okay..."
        },
        {
          "name": "Thanks!",
          "value": "You're welcome :wink:"
        }
      ],
      "thumbnail": {
        "url": "https://upload.wikimedia.org/wikipedia/commons/3/38/4-Nature-Wallpapers-2014-1_ukaavUI.jpg"
      },
      "image": {
        "url": "https://upload.wikimedia.org/wikipedia/commons/5/5a/A_picture_from_China_every_day_108.jpg"
      },
      "footer": {
        "text": "Woah! So cool! :smirk:",
        "icon_url": "https://i.imgur.com/fKL31aD.jpg"
      }
    }
  ]
}

And how it looks

example

Getting Started

Account on IFTTT

Visit IFTTT and create an account (if you haven't one).

Webhook on Discord

  1. Go to Server settings -> Webhooks -> Create Webhook
  2. Setup name, avatar and the channel, where it will be posted. Copy Webhook URL. Do not share! Very dangerous!
  3. Click Save and then the Done button

Creating an Applet

If this

  1. Go to My Applets -> New Applet
  2. Click [+]this
  3. Choose a service. In theory, you could use all of them
  4. Choose the trigger. Read the description below every trigger and choose the needed one
  5. Complete trigger fields. There can be more than one step. Read the descriptions and examples

Then that

  1. Click [+]that
  2. Choose the action service. You need Webhooks. Use the search bar
  3. Choose action. Choose Make a web request
  4. Paste your Webhook URL to URL field
  5. Select POST method
  6. Select application/json content type
  7. And now the hardest part™. You need to create your JSON body. Follow the structure, use it as an example and don't forget about common sense. Press + Ingredient button and put the Ingredients into appropriate fields. If something says URL put it in "url":"{{URL}}", if something says ImageURL, try to put that into "image": {"url":"{{ImageURL}}"}. There's no universal solution
  8. Click Create Action and then Finish
  9. Done!

Tips

  • Don't forget to check your JSON body with a JSON validator. If you don't know any use one of these:
  • If the webhook doesn't work, check log for errors. My Applets -> choose applet -> click gear -> View activity log. Maker error means your JSON body has errors.
  • Discord has built-in embeds for Twitter, Youtube and other sites so you can just add the link to the webhook: {"content": "{{Link}}"}.
  • Too hard? Use the picture guide instead!

Examples

Reddit

{
  "embeds": [
    {
      "title": "{{Title}}",
      "description": "[Link]({{PostURL}})",
      "image": {
        "url": "{{ImageURL}}"
      },
      "footer": {
        "text": "Author: {{Author}}"
      }
    }
  ]
}

Youtube

{
  "content": "{{Url}}"
}
@kevindevm
Copy link

kevindevm commented Dec 10, 2018

can u send a file like from a attachment from gmail to discord?

Loading

@Birdie0
Copy link
Author

Birdie0 commented Jan 30, 2019

@kevindevm IFTTT doesn't provide multipart/form-data content type required for sending attachments using Discord Webhooks. To achieve something like that you need to make middle server that will receive data from IFTTT, download attachment and send webhook with it.

Loading

@WeaselOnaStick
Copy link

WeaselOnaStick commented Apr 6, 2019

how do I ping someone using webhook message?

Loading

@Hantick
Copy link

Hantick commented Jun 24, 2019

Thank you, it helped

Loading

@LameLemon
Copy link

LameLemon commented Oct 13, 2019

Hello, thank you for posting this guide, I manged to trigger a webhook with the following data in Python using requests:

payload = {
  "username": "Webhook",
  "avatar_url": "https://i.imgur.com/4M34hi2.png",
  "content": "Text message. Up to 2000 characters.",
}

However including the embeds results in the following response with status code 400:

{"embeds": ["0"]}

I am not sure what I've done wrong. Tried checking online, following the docs and using your example but they all result in the same response.

Loading

@Birdie0
Copy link
Author

Birdie0 commented Oct 13, 2019

Hello, thank you for posting this guide, I manged to trigger a webhook with the following data in Python using requests:

payload = {
  "username": "Webhook",
  "avatar_url": "https://i.imgur.com/4M34hi2.png",
  "content": "Text message. Up to 2000 characters.",
}

However including the embeds results in the following response with status code 400:

{"embeds": ["0"]}

I am not sure what I've done wrong. Tried checking online, following the docs and using your example but they all result in the same response.

I'm not sure what cause the problem and because I haven't seen embed code yet, but you may try adding /v7 after /api in webhook url, that makes error messages more "verbose".

Loading

@swimmerz
Copy link

swimmerz commented Oct 18, 2019

When choosing the action service, what do you mean by "Maker?" The closes option to Maker is WeMo Maker and that doesn't connect to discord.
Screenshot 2019-10-18 at 5 30 42 PM

Loading

@Birdie0
Copy link
Author

Birdie0 commented Oct 18, 2019

@swimmerz it's called webhooks now. I edited the file, thanks 🍪

Loading

@swimmerz
Copy link

swimmerz commented Oct 18, 2019

@Birdie0 thanks for the help!

Loading

@LameLemon
Copy link

LameLemon commented Oct 20, 2019

I'm not sure what cause the problem and because I haven't seen embed code yet, but you may try adding /v7 after /api in webhook url, that makes error messages more "verbose".

I tried using the example you had above as well as some more embeds like the one below

    payload = {
        "username": "test_user",
        "avatar_url": "https://i.imgur.com/IFPMBBC.jpg",
        "content": 'https://reddit.com/',
        
        "embeds": [
            {
            "title": "test title",
            "description": "https://reddit.com/",
            "image": {
                "url": "https://i.imgur.com/5BPjiMS.jpg"
            },
            "footer": {
                "text": "Author: the_author"
            }
            }
        ]
    }

By using v7 as you suggested and here is the more verbose error

{"code": 50035, "errors": {"embeds": {"0": {"_errors": [{"code": "MODEL_TYPE_CONVERT", "message": "Only dictionaries may be used in a ModelType"}]}, "1": {"_errors": [{"code": "MODEL_TYPE_CONVERT", "message": "Only dictionaries may be used in a ModelType"}]}, "2": {"_errors": [{"code": "MODEL_TYPE_CONVERT", "message": "Only dictionaries may be used in a ModelType"}]}, "3": {"_errors": [{"code": "MODEL_TYPE_CONVERT", "message": "Only dictionaries may be used in a ModelType"}]}}}, "message": "Invalid Form Body"}

If I do

    payload = {
    "username": "test_user",
    "avatar_url": "https://i.imgur.com/IFPMBBC.jpg",
    "content": "https://reddit.com/",
    "embeds": [
        {
            "author": {
                "name": "Birdie♫",
                "url": "https://www.reddit.com/r/cats/",
                "icon_url": "https://i.imgur.com/R66g1Pe.jpg"
            }
        }
    ]
}

The error is


{"code": 50035, "errors": {"embeds": {"0": {"_errors": [{"code": "MODEL_TYPE_CONVERT", "message": "Only dictionaries may be used in a ModelType"}]}}}, "message": "Invalid Form Body"}

I'm still unable to trace where exactly I'm going wrong with the formatting or whether it's how the requests package in Python handles it.

Loading

@Birdie0
Copy link
Author

Birdie0 commented Oct 20, 2019

@LameLemon make sure it sends payload as application/json data. I assume multipart/form-data was used by default, which doesn't support arrays, so embeds too, but json may be used there with using payload_json, check this for more info.

Loading

@MrSlimeDiamond
Copy link

MrSlimeDiamond commented Mar 12, 2020

@WeaselOnaStick you should be able to do @user#tag. For example, if I do @SlimeDiamond#4226 it should ping user SlimeDiamond. This is a theory, I don't know if it will work.

Loading

@Birdie0
Copy link
Author

Birdie0 commented Mar 12, 2020

@MrSlimeDiamond it definitely doesn't work that way, you have to use user id. The correct approach is <@user-id>

Loading

@Aurorum
Copy link

Aurorum commented Apr 30, 2020

Is there any way to use an image URL based on base64? I've tried methods like this to no success:

  author: {
    name: "Captain Hook"
  },
  title: "My new embed",
  description: "This is a cool-looking Discord embed, sent directly from JavaScript!",
   image: {
      "url": 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAGCAYAAAD+Bd/...'
    }

Loading

@JudgePredator
Copy link

JudgePredator commented Jun 21, 2020

I want the Webhook to post a Facebook post. How can I do that? What is the structure code

Loading

@getsec
Copy link

getsec commented Jul 5, 2020

hook to post a Facebook post. How can I do t

So, to be able to do that, you'd need access to the facebook post through their API's then take that data and POST it via the webhook. @JudgePredator

Loading

@krutik-k
Copy link

krutik-k commented Jul 22, 2020

You can also use https://yamlonline.com/ for the yaml validator as well as yaml converter to json,csv,xml,base64 also for beautify and minify YAML.

Loading

@MrSlimeDiamond
Copy link

MrSlimeDiamond commented Jul 26, 2020

Oh, following on. Been a while lol. Yes, it's <@user-ID> i.e: <@323292144309633024> would ping SlimeDiamond

Loading

@redacted-dev
Copy link

redacted-dev commented Sep 30, 2020

really freaking cool, thanks!

Loading

@blackdackota
Copy link

blackdackota commented Feb 15, 2021

So how do I get a site to send information to my discord channel using an IFTTT webhook?

Loading

@Birdie0
Copy link
Author

Birdie0 commented Feb 15, 2021

So how do I get a site to send information to my discord channel using an IFTTT webhook?

What website?

Loading

@blackdackota
Copy link

blackdackota commented Feb 15, 2021

I'm the manager for the eSports team at my school and we run our competitions through https://www.playvs.com/. The site provides us with regional and state league standings as well as match schedules and statistics. I want to create a webhook for sending updates on that information to our discord.

Loading

@Birdie0
Copy link
Author

Birdie0 commented Feb 15, 2021

@blackdackota got it. I've checked the website and as far there's no API, only way to make it post to Discord is make script which will scrape the page (assuming you don't need to login to see standings) and build request body and send webhook, otherwise there no other ways i can think of.

Loading

@blackdackota
Copy link

blackdackota commented Feb 15, 2021

Oh okay. Can I still do that if a login is required to see the standings?

Loading

@Birdie0
Copy link
Author

Birdie0 commented Feb 15, 2021

@blackdackota, not really. There's only way that left and it's kinda complicated, with no automation (needs to be run manually) and basically running script in browser console, which will fetch values from page and send request.

Loading

@blackdackota
Copy link

blackdackota commented Feb 15, 2021

Damn, well okay thank you for your help.

Loading

@rajada1
Copy link

rajada1 commented Mar 4, 2021

I want to delete and update a message like this, where is messege.id?

Loading

@Birdie0
Copy link
Author

Birdie0 commented Mar 4, 2021

@rajada1 message id can be copied with right click on Discord (enable Developer Mode first). if you can handle request responds you you can add ?wait=true, that will make webhook reply return message object, which contains message id and other stuff.

Use PATCH /webhooks/{webhook.id}/{webhook.token}/messages/{message.id} route to update message
and DELETE /webhooks/{webhook.id}/{webhook.token}/messages/{message.id} to delete it.
https://discord.com/developers/docs/resources/webhook#edit-webhook-message

Loading

@rajada1
Copy link

rajada1 commented Mar 5, 2021

@rajada1 message id can be copied with right click on Discord (enable Developer Mode first). if you can handle request responds you you can add ?wait=true, that will make webhook reply return message object, which contains message id and other stuff.

Use PATCH /webhooks/{webhook.id}/{webhook.token}/messages/{message.id} route to update message
and DELETE /webhooks/{webhook.id}/{webhook.token}/messages/{message.id} to delete it.
https://discord.com/developers/docs/resources/webhook#edit-webhook-message

Thanks for the reply, this way it worked.
But is there any way to get message.id via api?

Loading

@Birdie0
Copy link
Author

Birdie0 commented Mar 5, 2021

@rajada1

But is there any way to get message.id via api?

You need bot for that, like use method that returns array of messages from channel etc.

Loading

@rajada1
Copy link

rajada1 commented Mar 5, 2021

@rajada1

Mas há alguma maneira de conseguir message.id via api?

Você precisa de bot para isso, como usar método que retorna matriz de mensagens do canal etc.

Thanks !

Loading

@blackdackota
Copy link

blackdackota commented Mar 22, 2021

So I learned some HTML and Python the last time I messaged you and I'm working on building the bot for what I talked to you about last time, (turns out you don't need to login to see standings). I ran into a problem though I'm not sure how to solve. When I scrape the page I don't get the full code from the website.

This is my code:

from bs4 import BeautifulSoup
import requests

html_text = requests.get('https://app.playvs.com/league/eastern-regional-high-school-rocket-league-rec?redirect=https://www.playvs.com/virginia&text=VA').text
soup = BeautifulSoup(html_text, 'lxml')
print(html_text)

This is the output:

<!doctype html>

<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="stylesheet" href="/static/css/bundle.2f8661ce.css">
<script> window.__APOLLO_STATE__ = {}; window.env = {"COOKIE_DOMAIN":".playvs.com","IS_BROWSER":true,"IS_NODE_ENV_PRODUCTION":true,"IS_NODE_ENV_DEVELOPMENT":false,"NODE_ENV":"production","MAINTENANCE":undefined,"API_ENV":"production","API_URL":"https:\u002F\u002Fapi.playvs.com","BATTLEDOTNET_AUTH_URI":"https:\u002F\u002Fapi.playvs.com\u002Fauth\u002Fbattle-dot-net\u002Foauth\u002FauthorizeNoRedirect","DISCORD_AUTH_URI":"https:\u002F\u002Fapi.playvs.com\u002Fpartner_api\u002Fdiscord\u002Fv2\u002FauthNoRedirect","DISCORD_SCHOOL_AUTH_URI":"https:\u002F\u002Fapi.playvs.com\u002Fpartner_api\u002Fschooldiscord\u002Fv2\u002FauthNoRedirect","EPICGAMES_AUTH_URI":"https:\u002F\u002Fapi.playvs.com\u002Fauth\u002Fepic-games\u002Foauth\u002FauthorizeNoRedirect","XBOXLIVE_AUTH_URI":"https:\u002F\u002Fapi.playvs.com\u002Fauth\u002Fxbox-live\u002Foauth\u002FauthorizeNoRedirect","FACEBOOK_AUTH_URI":"https:\u002F\u002Fapi.playvs.com\u002Fauth\u002Ffacebook-rally","FORTNITE_AUTH_URI":"https:\u002F\u002Fapi.playvs.com\u002Fauth\u002Fepic-games\u002Foauth\u002FauthorizeNoRedirect","GRAPHQL_URI":"https:\u002F\u002Fapi.playvs.com\u002Fgraphql","RIOT_AUTH_URI":"https:\u002F\u002Fapi.playvs.com\u002Fauth\u002Friot\u002Foauth\u002FauthorizeNoRedirect","STEAM_AUTH_URI":"https:\u002F\u002Fapi.playvs.com\u002Fauth\u002Fsteam\u002FnoRedirect","TWITCH_AUTH_URI":"https:\u002F\u002Fapi.playvs.com\u002Fauth\u002Ftwitch\u002Foauth\u002FauthorizeNoRedirect","TWITCH_SCHOOL_AUTH_URI":"https:\u002F\u002Fapi.playvs.com\u002Fauth\u002Ftwitchschool\u002Foauth\u002FauthorizeNoRedirect","FACEBOOK_PIXEL_ID":undefined,"INTERCOM_KEY":undefined,"LINKEDIN_PIXEL_ID":undefined,"SHEERID_PROGRAM_ID":"5ea217969318bb1c35c428e1","SEGMENT_KEY":"KxR2CiH74fpRKPizTaAd0sX9n7ea2hFh","SENTRY_DSN":"https:\u002F\u002F6affc91010eb4d8d901efb96564091af@sentry.io\u002F1519550","SNAPCHAT_PIXEL_ID":undefined,"STRIPE_PUBLIC_KEY":"pk_live_zRgvwgznx8Tpwhaje7lSX6CV","STRIPE_SECRET_KEY":"sk_test_0fsotpaV5U4MP5CeNGRfiEIH","ZENDESK_KEY":"987e7048-4533-4f91-bf9e-0c323ef166c7","FORTNITE_CONNECT_FEATURE":true,"SCRIMMAGE_FEATURE":true,"FEATURE_SCRIMMAGE_FILTERS":true,"PROJECT_SPAWN":true,"HIDE_TEAMS":false,"SETTLE_MATCH_FEATURE":true,"PLAYER_PROFILES":false,"PLAYER_STAT_HISTORY":false,"PLAYER_STANDINGS":true,"OPEN_ENROLLMENT":false,"REC_VARSITY_FEATURE":true,"PLAYER_LED_TEAMS_FEATURE":true,"SCHOOL_PROFILES":false,"LEAGUE_PROFILES":false,"REC_VARSITY_COLLEGE":true,"ENABLE_SSR":"disable","SPRING_2021":true,"COLLEGE_SPRING_2021":true,"YOUTH_LEAGUES":true,"YOUTH_LEAGUE_ONBOARDING":true,"XBOXLIVE_AUTH":true,"PSN_AUTH":true,"HEARTHSTONE_DECK":false,"BILLING_V2":false}; window.version = "/static/js/bundle.2f8661ce.js" </script> <script async src="https://js.stripe.com/v3/"></script> <script src="/static/js/bundle.2f8661ce.js" defer></script>

Process finished with exit code 0

Do you know how to solve this?

Loading

@Birdie0
Copy link
Author

Birdie0 commented Mar 22, 2021

@blackdackota by the output i can tell that this is not server side generated page (in this case scraping would work), but client-side, so that means data comes from api requests then page gets filled.
In developer tools -> requests tab -> filter by xhr, I see couple of requests and one of them returns json with data for leaderboard.

Here's ReqBin example, there you can even get generated code for python etc. Request structure is simple:

  • url: https://api.playvs.com/graphql
  • method: POST
  • headers:
    • Content-Type: application/json
  • body:
{
	"operationName": "getPhaseResults",
	"variables": {
		"phaseId": "0f4468aa-079b-4391-adbc-1fe971f64059"
	},
	"query": "query getPhaseResults($phaseId: ID!) {\n  phase(id: $phaseId) {\n    id\n    name\n    type\n    phaseResults {\n      id\n      phaseTiebreakerPoints\n      gamesWon\n      gamesLost\n      matchesWon\n      matchesLost\n      team {\n        id\n        name\n        esport {\n          id\n          slug\n          __typename\n        }\n        school {\n          id\n          name\n          logoUrl\n          slug\n          __typename\n        }\n        __typename\n      }\n      record {\n        won\n        lost\n        streak\n        winPercentage\n        matchesWonGamesWonGamesLost\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}\n"
}

Response by path data -> phase -> phaseResults contains all data you need. I recommend try to perform this request with some like Hoppscotch (online tool), Insomnia (installable) or Postman (installable) so you would see structure and figure out hot to extract it and format for sending to Discord.

Loading

@blackdackota
Copy link

blackdackota commented Mar 23, 2021

Okay I think I understand, thanks.

Loading

@blackdackota
Copy link

blackdackota commented Mar 25, 2021

Apparently I'm still confused.

So what is the Python code supposed to look like? Because I tried converting the code into Python using ReqBin but it didn't work how it should:

from requests.structures import CaseInsensitiveDict

url = "https://api.playvs.com/graphql"

headers = CaseInsensitiveDict()
headers["Content-Type"] = "application/json"

data = """
{
	"operationName": "getPhaseResults",
	"variables": {
		"phaseId": "0f4468aa-079b-4391-adbc-1fe971f64059"
	},
	"query": "query getPhaseResults($phaseId: ID!) {\n  phase(id: $phaseId) {\n    id\n    name\n    type\n    phaseResults {\n      id\n      phaseTiebreakerPoints\n      gamesWon\n      gamesLost\n      matchesWon\n      matchesLost\n      team {\n        id\n        name\n        esport {\n          id\n          slug\n          __typename\n        }\n        school {\n          id\n          name\n          logoUrl\n          slug\n          __typename\n        }\n        __typename\n      }\n      record {\n        won\n        lost\n        streak\n        winPercentage\n        matchesWonGamesWonGamesLost\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}\n"
}
"""


resp = requests.post(url, headers=headers, data=data)

print(resp.status_code)```

It looked to me that the main problem was that everything was a string, including the objects. So I tried to fix that but when it came to the "phaseID" and the "query" I wasn't sure what I was supposed to do with those. I want to convert the code to Python so I can use BeautifulSoup to parse it in PyCharm.

Loading

@Birdie0
Copy link
Author

Birdie0 commented Mar 25, 2021

you don't need BeautifulSoup, as data that comes from api is json and as i said before html parsing is not possible here as initial html doesn't contain data.
here's script that might fir your needs or help to reach your goal

first, install requests and tabulate packages: pip install -U --user requests tabulate
second, replace put url here in code with webhook url

import requests
from tabulate import tabulate

url = "https://api.playvs.com/graphql"
body = {
	"operationName": "getPhaseResults",
	"variables": {
		"phaseId": "0f4468aa-079b-4391-adbc-1fe971f64059"
	},
	"query": "query getPhaseResults($phaseId: ID!) {\n  phase(id: $phaseId) {\n    id\n    name\n    type\n    phaseResults {\n      id\n      phaseTiebreakerPoints\n      gamesWon\n      gamesLost\n      matchesWon\n      matchesLost\n      team {\n        id\n        name\n        esport {\n          id\n          slug\n          __typename\n        }\n        school {\n          id\n          name\n          logoUrl\n          slug\n          __typename\n        }\n        __typename\n      }\n      record {\n        won\n        lost\n        streak\n        winPercentage\n        matchesWonGamesWonGamesLost\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}\n"
}
r = requests.post(url, json=body)
data = r.json()["data"]["phase"]["phaseResults"][0:10]
table_data = [[
  i + 1,
  x["team"]["name"],
  x["matchesWon"],
  x["matchesLost"],
  f"{x['gamesWon']}-{x['gamesLost']}",
  x["record"]["streak"],
  x["phaseTiebreakerPoints"]
] for i,x in enumerate(data)]
headers = ["#", "Team", "Matches Won", "Matches Lost", "Game Record", "Win Streak", "Tiebreaker Points"]

webhook_url = "put url here"
webhook_body = {
  "content": f"```\n{tabulate(table_data, headers=headers)}```"
}
requests.post(webhook_url, json=webhook_body)
result:

image

data from site for reference:

image

Loading

@blackdackota
Copy link

blackdackota commented Mar 25, 2021

Alright, thank you.

Loading

@rawr37
Copy link

rawr37 commented Apr 7, 2021

can you make it so that it posts at a certain time and has different content each day (I'm doing it for a daily update thing, but everyday the content is different based on a weekly schedule (webtoon))

Loading

@Birdie0
Copy link
Author

Birdie0 commented Apr 9, 2021

@rawr37 on ifttt with filter code you can make it choose image depending on current day from predefined list, if you want data come from somewhere outside it need you to parse website by yourself and make some script to send it with cron or similar stuff like task manager on windows.

Loading

@Z0achary
Copy link

Z0achary commented Sep 12, 2021

how do I ping someone using webhook message?

@Username#tag

Loading

@Birdie0
Copy link
Author

Birdie0 commented Sep 12, 2021

how do I ping someone using webhook message?

@Username#tag

<@id> reference

Loading

@WindexProjects
Copy link

WindexProjects commented Oct 3, 2021

how do I ping someone using webhook message?

You can use <@(Their ID)> in the content message

Loading

@RogueRaven26
Copy link

RogueRaven26 commented Oct 10, 2021

What do I put in for Event Name???

Loading

@Birdie0
Copy link
Author

Birdie0 commented Oct 10, 2021

@RogueRaven26 IFTTT's incoming/if Webhook has nothing to do with Discord Webhooks, which is used in action/then part.

Loading

@Jossefht220
Copy link

Jossefht220 commented Dec 4, 2021

The truth is I don't know what I'm doing haha, I don't know if the parameter is right or is everything wrong, I don't know if you can give me a hand please.
2
1

Loading

@Birdie0
Copy link
Author

Birdie0 commented Dec 4, 2021

@Jossefht220 sorry, don't know what to fix here, what the programming language is that?

Loading

@Jossefht220
Copy link

Jossefht220 commented Dec 5, 2021

@Birdie0 c# in windows forms

Loading

@Birdie0
Copy link
Author

Birdie0 commented Dec 5, 2021

@Jossefht220 hmm, you might try checking Insomnia REST client, it has code generator, including C# for resharp and httpclient libraries. If that suits you try it.

Loading

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