How do I set the embed color?
codebeaulieu opened this issue · 4 comments
How can I set the color of the embed? I'd like to set Red on failed and Gold on succeeded.
Here's what I tried. Gold is a preset color for the Discord Api
messageType: 'embeds'
embeds: |
[{
"title":"App Api",
"description":"Build Succeeded",
"author": {
"name":"Azure DevOps"
},
"color": "Gold"
}]
I don't normally troubleshoot this stuff here because Discord has their own resources for this and there is a Discord channel for Discord devs.
That said, I'll give a hint for one thing, this isn't a YAML structure.
I don't normally troubleshoot this stuff here because Discord has their own resources for this and there is a Discord channel for Discord devs.
I'm familiar with their documentation, but that doesn't inform me as to whether your library supports setting the color.
That said, I'll give a hint for one thing, this isn't a YAML structure.
I'm not sure what you mean by "this isn't a YAML structure."
This works fine:
- task: ado-discord-webhook@1
inputs:
channelId: '{redacted}'
webhookKey: '{redacted}'
name: '{redacted}'
avatar: '{redacted}'
messageType: 'embeds'
embeds: |
[{
"title":"App Api",
"description":"Build Succeeded",
"author": {
"name":"Azure DevOps"
}
}]
Adding the color property doesn't work. But, looking at their documentation again, the value appears to be an integer. So, I should look up what the integer value is for the color.
Regardless, I still don't understand what you mean by "this isn't a YAML structure".
This task accepts a JSON object defined by the Discord docs. Whatever Discord sets for that structure, this will "support" because it simply passes the string object you wrote along to Discord.
Got it. I thought you were saying the YAML I shared was invalid.
Here is a gist with valid Discord color ids for those in the future:
https://gist.github.com/thomasbnt/b6f455e2c7d743b796917fa3c205f812
Example:
"color": 3447003