-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add discord message fields #3821
base: main
Are you sure you want to change the base?
Conversation
@yaskinny can you signoff your commits? That will fix the DCO check 🙂 |
Add Discord webhook content, avatar url and username fields Signed-off-by: yaser <[email protected]>
Add Username Signed-off-by: yaser <[email protected]>
3178f11
to
85d44df
Compare
hey, sorry for the delay. i was busy. I signed off my commits and pushed them again. let me know if i need to do anything else. Best Regards, |
also it might be beneficial to edit the default discord template in a way that older config version(without username/content) works without any issue after updating to newer alertmanager version. like making username/content optional in the template. since at this point, users need to rewrite their own template if they want to use username/content fields. with updating default template, it will has better UX since by default it will be included in the alerts. @grobinson-grafana let me know if you want me to work on that or not. |
I'm not sure I understand. What are you suggesting? |
I mean the default Discord template does not include the content field. alertmanager/template/default.tmpl Lines 126 to 136 in e5821b7
It would be better if the default template used the content field to allow anyone who uses the content option to utilize it without having to write their own template from scratch. However, since older versions of Alertmanager do not include the content field, we need to make it optional (use a condition in the template to check if content is set before using it). By making it optional, users won't face errors after updating to the new Alertmanager version. |
Is the suggestion to also replace the embeds with content? If not, what would the default template for |
You might also want to check out #3761 which extends the use of embeds. |
This PR adds some fields to Discord message like Content which is already mentioned in issue #3667.
Being able to set Content is really important to have since at this moment, there is no way to tag users in alerts. Default Discord
template embeds alerts and in Discord, ATM, tagging someone in embedded fields, does not tag them. It will just include user/role name without sending notification like when you get tagged in normal message.
Discord code already had
content
field but it's not used in the code nor config.I added other fields like avatar url and username.
Below content are example configs and result:
Alertmanager receiver config:
Template:
Prometheus alert: