Slack Notifications - Status missing info

(I’m new to the CircleCI platform, so please correct me if any assumptions below are incorrect)

We’ve recently been notified that the “legacy Slack Notification settings will not be available in the new UI” via this post.

I attempted to follow step 1 (“Remove the Slack webhook url from the legacy chat notification page”) by editing the URL to contain our organization name and project names. However I cannot seem to get to the old UI. Clicking on links on this page results in the following message:

Error! GraphQL error: Received a 404 from the /api/v2/project/github/ORG/PROJECT/envvar api.

I’ve decided to skip that step for now.

I’ve enabled the new Slack integration as per step 2, but the new integration seems to be missing a lot of information that made the status notifications useful.

Here’s what the old and new notifications look like:

old_vs_new

Notice the lack of links to the repo, branch, and commit as well as it not showing the commit message or author.

I’ve looked at the documentation for the orb here but I don’t see any way to have it show all of the information that the old integration used to show.

Am I missing something here?

2 Likes

Hi @Justin-Credible. Welcome to the CircleCI community!

Try temporarily switching to the legacy UI (as outline here) before attempting to access the URL https://circleci.com/gh/ORGNAME/PROJECTNAME/edit#hooks

The linked Support article also explains how to go back to the new UI.

In case you’re still having trouble removing the Slack webhook url from the legacy chat notification page, please open a Support ticket so we can further investigate.

Regarding the new Slack notification, the message you’re seeing is the default success_message, as per the orb source.

However, you can customise it to suit your needs. For example, you could retrieve and store the commit message and the author name in variables during the build, and then refer to those variables in the success_message parameter:

COMMIT_MESSAGE=$(git log --format="%s" -n 1 $CIRCLE_SHA1)
COMMIT_AUTHOR=$(git log --format="%an" -n 1 $CIRCLE_SHA1)

And when calling the status command of the Slack orb, the success_ message parameter would be:

success_ message: ' $COMMIT_AUTHOR\'s $CIRCLE_JOB job (message: $COMMIT_MESSAGE) has succeeded!'

You can find more git log specifiers here

1 Like

Thank you, I was able to get to the old UI to adjust the old Slack integration.

As for the notifications via the Slack Orb… how do we have the notification sent when a job fails that has parallelism? If I add the orb at the bottom of the job we are alerted of successes and failures on each node, when the previous integration only alerted us once all of the nodes in the job finish.

Let me rephrase that. Ignoring the content of the message, is there a way to get the behavior of the old messaging?

The old behavior was to send a single success or failure message for the workflow. However, using the new orb it appears we have to insert that as a job stop, which results in a success and/or failure message for each job (which is then further compounded for jobs that have parallelism set).

We just want a single success/failure message for a workflow run, like we used to have. How do we do that?

@yannCI Are you or someone else at CircleCI able to answer the follow up question above?

You could run another job that pings the API and waits for all jobs in the workflow to finish.

I haven’t tested this, and it looks incomplete, but there is the start of a 3rd party project Orb that tries to run another job that tracks the workflow. Maybe you could take a look and see if it would give you some ideas for a solution you could implement.

Thanks for the suggestion.

Please consider adding official support for this, without using an orb or external job.

To re-iterate: this is currently working, today, built-in to CircleCI. It’s disappointing to hear that it’s being deprecated without an official replacement.

Am I thinking about this the wrong way? Our developers push code and then get notified in Slack if the workflow was a success or failure. That seems like a pretty common use case, which I assume was why it was built into CircleCI to begin with.

1 Like