Display Jenkins output into Slack - jenkins

I'm trying to display open/stale branches onto slack to remind people to admin them accordingly.
Ive gotten Jenkins to get the information needed from Git via shell commands.
But how can one display this information in the Jenkins UI console to a Slack channel?
Any suggestions?
S

You should look into incoming webhooks. Slack provides you a link and you can send a curl command to put the message into slack.
More information here: https://api.slack.com/incoming-webhooks

Related

How to send daily Confluence reports /JIRA dashboard in email using Jenkins

I have requirement to grab details from either JIRA Dashboard or Confluence Page and send it it in daily status report to selected recipients. I just wanted to understand if this can be done using Jenkins as in sending daily status report
Thanks in advance.
Check if you can get details from JIRA or Confluence using a script or other prefered method. If that's possible you can send the details to selected recipients as a email.

How to send pipeline changes(commits) notification to microsoft teams\skype using jenkins

I want to send pipeline changes(commits) notification to teams channel using Jenkins and notify all what changes have been deployed. I know about the office365 plugin in jenkins but the problem is it only tells the status of pipeline etc pass/fail/stopped.
P.S sending notification to skype would also work. Please help!!
This can be setup directly in teams through the connectors marketplace.
First click on the elipses of a channel you want the information to be posted to.
Search for jenkins and configure
From here you should be able to run through the configuration process supplying details as required.

is there an api method for slack that takes a channel name as an argument and returns a token?

I'm trying to setup a Jenkins job to be able to take a slack channel name as a parameter, and then post messages, about who kicked off the build, and if it completed etc, how can my job get a slack token, for any given channel?
No. This is not how tokens work with the Slack API. Tokens are always user based and for the whole workspace. So once you have a token you app can post to any public channel.
To get a token a user needs to install your Slack app. *)
Alternatively can create "dynamic" webhooks, that can post to any channel in a workspace. Check out this answer for details:
Creating a Slack Webhook programmatically
However, those are officialy legacy and might stop working some time in the future. So your safest approach would be to create a Slack app and install it to the workspace to get your token.
*) There once was a concept called "workspace tokens". You still find it in the documentation, but it never left the BETA stage and was canceled. Best to ignore it.

Slack integration on Bitbucket server

I cannot see Webhook function on Bitbucket server. The view is different from the Bitbucket on Cloud. The main goal of mine is i am trying to integrate Slack to get all updates from Bitbucket. Could anyone help me figure this out?
To do this you will need to install the 'Slack Notifications Plugin'.
BitBucket server works on a 'add additional functionality as you need it' model, whereas BitBucket cloud has to cater to a large number of possible user needs where users don't have admin to install the plugins themselves.
To setup: navigate to the custom integrations tab on the Apps admin page in Slack, then select 'Incoming Webhooks', 'Add configuration', choose a channel and hit add. You should now have a webhook URL copy this. (you can come back and change the appearance of your webhook user later on or edit it now)
Take the URL you copied, and go to the admin page for your repository in BitBucket server, click 'Slack settings'. Select the events you want to receive messages for, if you want to receive notifications for commits then tick the Push notifications option. Enter the channel name you want to post to including the # e.g. #git and paste in your Webhook URL. Save.
Now when you push a commit to BitBucket you should get a message in the specified Slack channel.
The official Bitbucket Server integration for Slack, developed by Atlassian, is now released with Data Center support. You can try it out right now.
Disclaimer: I work for Atlassian.

How to create Slack Slash Command automatically when user install Slack App in his team?

I am developing Slack bot, and I want to provide users with ability to use slash commands eg /command1.
User deploys my Slack Bot via Slack Button. What options do I have to make this possible?
I attach screenshot of different other bots slash commands which I installed in my Slack command and did no any additional tweaking. How to do same?
https://api.slack.com/docs/slack-button
See: Attach a slash command to your app (optional)

Resources