Closed fernandocarletti closed 9 years ago
Of course. The fields
is used for adding more "rich" data to the message, ass this example:
In this case, Project
and Environment
are two different fields, and ReferenceError - UI is not defined
is the text of the message.
The fallback
, allows you to display a simple text message where the "rich" data can't be displayed (e.g. notifications).
More info: https://api.slack.com/docs/attachments
Ah. Slick. So fields are 'Project' and "Environment'? Would you mind adding a bit to to the readme to explain this (if you want to embed that screenshot, that's cool too). Could see a lot of folks wanting to adopt it.
I was thinking about to put my format as default, but it would break backward compatibility. I can share my config later, but it still need some improvements (right now it is really specific about my company).
This is what I have so far:
Yeah, I've had three formatting PR's in the last week. I think I'd prefer to leave the default alone to avoid a format war, but a section in the README (or maybe I should open up the wiki) on custom formats would be nice. README or wiki? Thoughts?
We would have to define what information we want to display. The links, I am getting in a dumb way right now, It would have to be improved in order to get it abstract enough for having it as standard.
About the format war, since the fields are highly customizable, we should define a default format and let the user change the way they want.
My current configuration is this:
set :slack_fallback_finished, "#{fetch(:slack_deploy_user)} deployed #{fetch(:application)} on #{fetch(:stage)}"
set :slack_fields_finished, [
{
"title": "Project",
"value": "<https://github.com/XXXXXXX/#{fetch(:application)}|#{fetch(:application)}>",
"short": true
},
{
"title": "Environment",
"value": fetch(:stage),
"short": true
},
{
"title": "Deployer",
"value": fetch(:slack_deploy_user),
"short": true
},
{
"title": "Revision",
"value": "<https://github.com/XXXXXXX/#{fetch(:application)}/commit/#{fetch(:slack_revision)}|#{fetch(:slack_revision)[0..6]}>",
"short": true
}
]
Since the variables are already there, it is a matter of disabling the msg
and putting the fields
and fallback
in action. Who needs it different, customize it.
I'll add this in the README.md
for now.
@phallstrom I added more information to the README.md
.
Thanks @xurumelous! I've pushed 0.1.12 to rubygems.
@xurumelous Can I trouble you to save me a bit of research and quickly explain what fields/fallback are for? What's the reason for them? Thx!