If you don't know anything about JSON, please, spend some time on learning JSON structure.
Recommended sources:
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 webhookavatar_url
:[url of image]
- if used, it overrides the default avatar of the webhookcontent
:[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
:[url of website]
- url of author. Ifname
was used, it becomes a hyperlinkicon_url
:[url of image]
- url of author icon
title
:[string]
- title of embedurl
:[url of website]
- 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 picker and converterfields
:[array]
- array of embed field objectsname
:[string]
- name of the fieldvalue
:[string]
- value of the fieldinline
:[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 objecturl
:[url of image]
- url of thumbnail
image
:[object]
- embed image objecturl
:[url of image]
- url of image
footer
:[object]
- embed footer objecttext
:[string]
- footer text, doesn't support Markdownicon_url
:[url of image]
- 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!
- 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!
{
"embeds": [
{
"title": "{{Title}}",
"description": "[Link]({{PostURL}})",
"image": {
"url": "{{ImageURL}}"
},
"footer": {
"text": "Author: {{Author}}"
}
}
]
}
{
"content": "{{Url}}"
}