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!
Using embeds block prevents generating automatic ones, also why you copied text it over and over?
Only solution that might work I have on my mind is using filter code to filter out links from tweet and then append them to content so both tweet and links in it get embed, but there's a problem that tweet images also included in text and they're shortened with t.co, so distinguish them is not possible. Appending them will result in duplicate embeds.