The Issue
So, as you can see by the workflow, I want to integrate my blog with a discord embed…
looking around the community, I am not the only one struggling to do this.
Discord webhooks seem to be a problem for a lot of people, and also for me
I don’t know why, but it won’t work… my discord webhook is simple just take the parameters and put their info the right place:
{
"content": null,
"embeds": [
{
"title": "{{$json[\"title\"]}}",
"description": "{{$json[\"contentSnippet\"]}}",
"url": "{{$json[\"title\"]}}",
"color": null,
"author": {
"name": "{{$json[\"title\"]}}"
},
"footer": {
"text": "{{$json[\"title\"]}}"
}
}
],
"attachments": []
}
Workflow
Error Code
Embeds must be valid JSON.
In8n setup
n8n version: 0.199.0
Database: SQLite
Running n8n own
*Running n8n via *Docker
I did more testing, and it seems like it’s not a valid JSON because of the parameters
{
"embeds": [
{
"title": {{$json["title"]}},
"description": {{$json["contentSnippet"]}},
"url": {{$json["link"]}},
"color": 4011867,
"timestamp": null,
"footer": {
"icon_url": null,
"text": {{$json["pubDate"]}}
},
"thumbnail": {
"url": null
},
"image": {
"url": null
},
"author": {
"name": "author name",
"url": "https://discordapp.com",
"icon_url": "https://cdn.discordapp.com/embed/avatars/0.png"
},
"fields": [
]
}
]
}
as you can tell, I have a syntax error
Hi @thefourCraft , welcome to the community!
I am sorry to hear you’re having trouble. Using JSON in the Discord node is a bit tricky and I needed to play around with it for quite a bit before I got it to work. Perhaps you could check out this example I provided earlier?
Hi @mrhappyma , welcome to the community!
Tbh, I struggled with this as well in the past and at some point gave up and simply used the HTTP Request node over the Discord one for this.
Following your post I have looked into this a bit closer and it seems the Discord node expects an array-like string with one or more embeds. So something like this would work:
This workflow posts a message like this:
[image]
Let me know if you still face any trouble afterwards.
Did you manage to make this work?
I would like a template code to base myself on the same purpose
I found this which sounds interesting
both of them together my solve the issue , but I am not sure about the security
NPM is not a safe tool and Risks - n8n Documentation
An Update About The Situation
This works, but discord is kinda stupid @MutedJam I did look at your setup and
Hi @mrhappyma , welcome to the community!
Tbh, I struggled with this as well in the past and at some point gave up and simply used the HTTP Request node over the Discord one for this.
Following your post I have looked into this a bit closer and it seems the Discord node expects an array-like string with one or more embeds. So something like this would work:
This workflow posts a message like this:
[image]
It does work, but you can’t add description
it does solve my problem kinda, I can simply attach the photo to the context of something
Another Update
I managed to make it work, what… by using the contact and the embed I was able to create a nice webhook
1 Like
Sweet, glad to hear that. Thanks so much for sharing your solution!
system
Closed
November 9, 2022, 2:53pm
9
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.