Question

Webhook POST embed to Discord not including all information for the request

  • 19 March 2022
  • 4 replies
  • 2492 views

I have created a custom request to POST embedded messages to Discord, as per the below:

Webhook is setup and working now after using Headers: Content-Type application/json to remove the bad request error

But the message in discord only displays at the content line - can anyone help


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

here is the rest of the custom request

 

the webhook is working - however it will only post ‘content’ line

 

Userlevel 7
Badge +11

Hey @C123, welcome to the Community!

Hmm, I took a look and it seems that you’re referencing embed rather than embeds and it’s missing the necessary square brackets [ ] for the embeds array. I’ve run a quick test and was able to get it working with using the following format for the request:

{
"content": "Enter message text here",
"embeds": [{
"title": "Enter embed title text here",
"description": "Enter embed description text here",
"color": 8584966,
"footer": {
"icon_url": "https://footericonurl.png",
"text": "Enter footer text here"
},
"author": {
"name": "Enter Author name",
"url": "http://authorurl.com",
"icon_url": "https://authoriconurl.png"
},
"fields": [{
"name": "field name 1",
"value": "field value"
},
{
"name": "field name 2",
"value": "field value"
},
{
"name": "field name 3",
"value": "field value"
},
{
"name": "field name 4",
"value": "2022-03-21T13:00:00.000Z",
"inline": true
},
{
"name": "field name 5",
"value": "2022-03-21T16:00:00.000Z",
"inline": true
}
]
}]
}

Looking at Discord’s API it doesn’t appear that timestamp is an option you can use (Discord API Embed > Fields). When I was testing the timestamp was only able to be sent through when passed to the field as a “value” rather than “timestamp”. So you may need to add in a Formatter step ahead of the webhook one to format the date into the desired format (see Modify date and time formats in Zaps) before sending it over to Discord as a value. 

Hopefully the above will be helpful in fixing it! :relaxed:

Thank you - yes you are right, changing to embeds solved it.

I also solved the timestamp issue as well

 

{

"name": "WL mint time",

"value": "<t:1. Wl Mint Time:1647878400:f>",

"inline": true },

{

"name": "Public Mint Time",

"value": "<t:1. Public Mint Time:1647964800:f>",

"inline": true }

 

I already have a timestamp conversion in the database, so after changing the “value” to <t:TIMSTAMP:f> the output works in the embed in discord.

 

there is no need for the additional step, as long as the database contains a timestamp