Slack WebHook Integration for Java
// Send simple message
SlackApi api = new SlackApi("https://hooks.slack.com/services/id_1/id_2/token");
api.call(new SlackMessage("my message"));
// Send simple message with custom name
SlackApi api = new SlackApi("https://hooks.slack.com/services/id_1/id_2/token");
api.call(new SlackMessage("Mafagafo", "my message"));
// Send simple message in different room
SlackApi api = new SlackApi("https://hooks.slack.com/services/id_1/id_2/token");
api.call(new SlackMessage("#general", null, "my message"));
// Send simple message in different room with custom name
SlackApi api = new SlackApi("https://hooks.slack.com/services/id_1/id_2/token");
api.call(new SlackMessage("#general", "Mafagafo", "my message"));
Add the following dependency in pom.xml
<dependency>
<groupId>net.gpedro.integrations.slack</groupId>
<artifactId>slack-webhook</artifactId>
<version>1.2.1</version>
</dependency>
- Go to your_team.slack.com/services/new
- Search for Incoming WebHook and click in
Add
- Choose Channel to Post and press
Add Incoming WebHooks Integration
- Into Setup Instructions, you've a WebHook URL. He is the argument you must pass the constructor. Then, copy it.
- 1.2.1
- Improved MatterMost Compatibility
- 1.2.0
- Added Support for Proxy
- 1.1.2
- Added Support for Markdown in SlackAttachment
- 1.1.1
- General Improvements
- 1.0.0
- Init (: