In a recent post, I explained how one could send messages on Discord through a Webhook using JavaScript XMLHttpRequests. In this post, I'm gonna co...
For further actions, you may consider blocking this person and/or reporting abuse
This is cool, +1!
Hey im having a problem with including fields, when i try to use them and i run the code it doesnt show the field(s), it doesnt return any error, but it runs everything else fine. Im not sure if im putting it in wrong or somthing else.
here is my code: pastebin.com/5KCc1ET7
So I took a look at your code and it seems fine, so I think the issue is in the Webhook endpoint URL. Check if you’ve got it correct, because browsing to that URL returns a 'Unknown Webhook' response.
Yeah i have the webhook url correct because when i run the code it sends the all of the other data, but it doesnt send the field. picture below of what the code i sent shows:
cdn.discordapp.com/attachments/945...
Also if you dont mind can you send me an example of code that successfully sends the field, Thanks.
i use fileds and its not working
Okay and? Please develop your question if you need help.
Can the webhook be used to read the message in a channel? I am a subscriber but not the owner of the Discord Channel but want to be notified by SMS or Email when a new post appears in the channel
That isn’t possible using Webhooks, as they are made to only send data in server channels, and not receive. However, you can setup a Discord Bot to read messages, but for that you’ll need to host a server.
if I host a server and build this discord bot, can this read messages from other channels of which I am not the admin?
Yes absolutely, the only permission the bot needs is to be able to read messages from that channel, and if that permission is granted then it’ll work
For fields, I do not want a value, what would I place there instead?
Every property of the embed object is optional, so you can just remove the
fields
array if you don’t want it.I have tried to remove the
value
, but when I save and send the webhook, the message does not appear in my server. I am not too sure what you mean by fields array.Waw
Hello !
How can I include the forms informations on the webhook ?
Thank you for help !
You mean taking data from an HTML form and sending that in the webhook?
Well you first have to get the raw text that is in each input of that form, and put that in the webhook payload.
For example, if you have an input on your page and want to tell the webhook to send that as the embed description, you would do it like so:
i dont understand it at all
it doesn't work for me at all, not showing signs of life. Only the one without color works in the first tutorial.
Hello @BoiDevis just change
color: hexToDecimal("#ff0000")
withcolor : 16711680
@plug18343602 yeah you can use a decimal color value like @pealco821103 said, but you can also include the hexToDecimal function if you want to use a HEX color code:
I created a page of my site where I tried to integrate all the functions -> mmmm.world-heberg.com/webhook/ (in french)
Your link is expired.
it doesn't work for me the embed
Does the browser console return any error ?
i gave up on it, so i'm using discohook instead, it makes things easier for me
Oh yeah that's totally an option if you just want to send one specific Webhook message, but this post is about learning how to code that, which is useful if you want to integrate that to your own application, so your Webhook can send messages when events occur in it.
Hello @oskarcodes I found the issue.
We can't use
color: hexToDecimal("#ff0000")
, instead we have to use decimal code so just changecolor: hexToDecimal("#ff0000")
withcolor : 16711680
Probably you have other script to execute that
hexToDecimal
command.Hope it helps
Oh well yeah the hexTodecimal function is just this:
hello how can i add reaction to my embed message?
That isn’t possible using Webhooks. Use discord bots instead. However for that you’ll need to host a server.
How can i use in the Embet my variables ?
Hey how would one add a button that can send a user to a URL? Thanks in advance.
Will you make a tutorial on how to write messages in HTML not changing code