How to send slack notification in Jenkins based on variable? - jenkins

I want to send some alerts if something happened in the middle of the build.
I'm planning to save it to environment variable.
I want to trigger Slack Notification based on this environment variable.
It means that if the environment variable is there, I want to trigger Slack Notification.
Is it possible somehow?

Yes it is possible, either by using slack webhook api directly either using 3rd party tools like Jenkins Slack plugin.

Related

Slack notification on Jira notifications, for me only

Is it possible to set up Slack so that I get a notification when I receive a Jira notification?
I am looking for a way to do this for myself only. I don't want to send notifications to a Slack channel visible to everyone.
It looks like the Jira Cloud app has options for this: https://my.slack.com/apps/A2RPP3NFR-jira-cloud!
There's more info in the Atlassian page as well: https://www.atlassian.com/partnerships/slack?tab=jira

How to send test execution report (report.html) from jenkins by using Slack notification add-on

I just installed the slack notification add-on in Jenkins and I can get notification if the build is success/failed as like below:
I wanna add few more things here since I'm very new to this implementation and looking help from experts.
I just wanna add test execution report (.htm) file and send it into this channel along with build number and job URL.
If the build is failed. I just want to capture the build failed message from console log and need to send that message to slack channel instead of saying the build failed.
Can someone help me to achieve this?
I just tried the notification but don't know how to attach the html report and add custom message for failed jobs. If there is any reference that will be very helpful.

Creating custom triggers in Zapier

So ive setup intercom to textlocal zaps but there is really no way to create a custom zap. For example, I want to trigger a zap when my clients (registered on intercom) make a purchase or have low credits in their wallet.
Has anyone set custom triggers before?
You can use custom triggers by creating your own app using the Zapier developer platform. The app is then available within your Zapier account to use with zaps.

Jenkins Slack Integration to set reminders

I am trying to set Slack reminders via a Jenkins job. We are using the Slack plugin (https://plugins.jenkins.io/slack) which seems to work great for direct messages, but I am unable to set reminders. Running the /remind command in Slack, obviously, works. But when I try to use the same command as a Custom Message, it doesn't. Following is what I have set currently, but it doesn't seem to work ie no reminders are getting set.
The Custom Message field in the Slack plugin is just for messages - it is not parsed by Slack for Slack slash commands that are ordinarily typed by a Slack user in Slack's message entry field.
The Slack plugin appears to label the contents of the Custom Message field as text and wrap other info around it in order to provide the green/amber/red indicator that is displayed to the left of the message, along with the build # and Success/Fail etc. notification.
See https://api.slack.com/docs/message-formatting

How can I add my own button in slack chat box by slack API

I am trying to develop an APP and integrate it with Slack.
I have a confusion, can I add the app into chat box just like DropBox did? I searched the Slack API and found nothing about it.
enter image description here
No, as far as I know this feature is not available to Slack developers at the moment. Might be added at a later time though.
You could use a slash command instead to trigger your external application.

Resources