Source:
public static void publishNotification(CollectionBase collection, CollectionStage stage, StageStatus status) { if (collection == null) { logWarn("failed to send publish slack notification as published collection was null").log(); return; } PostMessage pm = new PostMessage(slackUsername, slackPublishChannel, PostMessage.Emoji.ChartWithUpwardsTrend, "Unknown publish stage or status"); PostMessageAttachment attch = new PostMessageAttachment("", "", PostMessageAttachment.Color.Good); pm.attachments.add(attch); addCollectionAttachment(attch, collection); boolean forceNewMessage = false; switch (stage) { case PrePublish: switch (status) { case Started: forceNewMessage = true; pm.text = "Pre-publish started for collection"; attch.color = "warning"; break; case Completed: pm.text = "Pre-publish completed for collection"; attch.color = "good"; break; case Failed: pm.text = "Pre-publish *failed* for collection"; attch.color = "danger"; break; } break; case Publish: switch (status) { case Started: forceNewMessage = true; pm.text = "Publish started for collection"; attch.color = "warning"; break; case Completed: pm.text = "Publish completed for collection"; attch.color = "good"; break; case Failed: pm.text = "Publish *failed* for collection"; attch.color = "danger"; break; } break; case PostPublish: switch (status) { case Started: pm.text = "Post-publish started for collection"; attch.color = "warning"; break; case Completed: pm.text = "Post-publish completed for collection"; attch.color = "good"; break; case Failed: pm.text = "Post-publish *failed* for collection"; attch.color = "danger"; break; } break; } postSlackMessage(pm, collection.getId(), forceNewMessage); }

Target:
public static void publishNotification(CollectionBase collection, CollectionStage stage, StageStatus status) { if (collection == null) { logWarn("failed to send publish slack notification as published collection was null").log(); return; } PostMessage pm = new PostMessage(slackUsername, slackPublishChannel, PostMessage.Emoji.CHART_WITH_UPWARDS_TREND, "Unknown publish stage or status"); PostMessageAttachment attch = new PostMessageAttachment("", "", PostMessageAttachment.Color.GOOD); pm.getAttachments().add(attch); addCollectionAttachment(attch, collection); boolean forceNewMessage = false; switch (stage) { case PRE_PUBLISH: switch (status) { case STARTED: forceNewMessage = true; pm.setText("Pre-publish started for collection"); attch.setColor("warning"); break; case COMPLETED: pm.setText("Pre-publish completed for collection"); attch.setColor("good"); break; case FAILED: pm.setText("Pre-publish *failed* for collection"); attch.setColor("danger"); break; } break; case PUBLISH: switch (status) { case STARTED: forceNewMessage = true; pm.setText("Publish started for collection"); attch.setColor("warning"); break; case COMPLETED: pm.setText("Publish completed for collection"); attch.setColor("good"); break; case FAILED: pm.setText("Publish *failed* for collection"); attch.setColor("danger"); break; } break; case POST_PUBLISH: switch (status) { case STARTED: pm.setText("Post-publish started for collection"); attch.setColor("warning"); break; case COMPLETED: pm.setText("Post-publish completed for collection"); attch.setColor("good"); break; case FAILED: pm.setText("Post-publish *failed* for collection"); attch.setColor("danger"); break; } break; } postSlackMessage(pm, collection.getId(), forceNewMessage); }