First, learn JSON. It's not programming language, not even close. Just follow syntax rules and you will be fine.
Recommended sources:
Second, learn the structure.
All root elements are optional unless stated otherwise. Body have to include content
or embeds
, otherwise request will fail.
element
:[data type]
- description
-
[string]
- text[website url]
- ex.:https://google.com
[image url]
- ex.:https://www.w3schools.com/html/pic_mountain.jpg
-
[array]
- comma-separated elements. ex.:[1, 2, 3, 4]
-
[number]
- ex.1337
,420.69
,-1000
, etc. -
[boolean]
- can betrue
orfalse
only. -
[object]
- can includekey: value
s -
username
:[string]
- overrides the default username of the webhook -
avatar_url
:[image url]
- 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 bodyauthor
:[object]
- embed author objectname
:[string]
- name of authorurl
:[website url]
- url of author. Ifname
was used, it becomes a hyperlinkicon_url
:[image url]
- url of author icon
title
:[string]
- title of embedurl
:[website url]
- url of embed. Iftitle
was used, it becomes hyperlinkdescription
:[string]
- description textcolor
:[number]
- color code of the embed. You have to use Decimal numeral system, not Hexadecimal. Use color pickerfields
:[array]
- array of embed field objectsname
:[string]
- name of the fieldvalue
:[string]
- value of the fieldinline
:[boolean]
- 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 objecturl
:[image url]
- url of thumbnail
image
:[object]
- embed image objecturl
:[image url]
- image url
footer
:[object]
- embed footer objecttext
:[string]
- footer text, doesn't support Markdownicon_url
:[image url]
- url of footer icon
{
"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"
}
}
]
}
Visit IFTTT and create an account (if you haven't one).
- Go to Server settings -> Webhooks -> Create Webhook
- Setup name, avatar and the channel, where it will be posted. Copy Webhook URL. Do not share! Very dangerous!
- Click
Save
and then theDone
button
- Go to My Applets ->
New Applet
- Click
[+]this
Choose a service
. In theory, you could use all of themChoose the trigger
. Read the description below every trigger and choose the needed oneComplete trigger fields
. There can be more than one step. Read the descriptions and examples
- Click
[+]that
Choose the action service
. You needWebhooks
. Use the search barChoose action
. ChooseMake a web request
- Paste your Webhook URL to URL field
- Select
POST
method - Select
application/json
content type - 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 saysURL
put it in"url":"{{URL}}"
, if something saysImageURL
, try to put that into"image": {"url":"{{ImageURL}}"}
. There's no universal solution - Click
Create Action
and thenFinish
- Done!
- Use this awesome website to generate valid json wirh built-in preview: Discohook, also you can send webhooks to your server with it if you just wan't fancy embed in your channel without any automatization.
- 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}}"}
.
Check https://birdie0.github.io/discord-webhooks-guide Examples section!
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:
This is the output:
<!doctype html>
<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?