This project is a Spring Boot application designed to send messages to a Slack channel using Slack's Incoming Webhooks. The application provides a REST endpoint to accept a message and send it to a predefined Slack channel.
The main objective of this project is to create a Spring Boot application that sends messages to a Slack channel via Slack's Incoming Webhooks.
- REST endpoint
/sendSlackMessage
to accept POST requests with JSON payloads. - Integration with Slack using Incoming Webhooks.
- Configuration of Slack webhook URL via application properties.
- Unit and integration tests for the service and endpoint.
-
Build and Run the Application:
- Use Maven to clean, install, and run the application.
- Use IDE of your choice preferaably IntelliJ or Eclipse.
-
Test the Application:
- You can use these links to test it on my Slack channel:
- Slack Channel Link: Slack Channel
- Webhook Link: (Already mentioned in the code)
- You can use these links to test it on my Slack channel:
-
Use Your Own Webhook:
- Alternatively, you can use your own webhook and run it in your own Slack channel.
- To do this, set up a Slack Incoming Webhook and get the webhook URL.
- Update the
application.properties
orapplication.yml
file in thesrc/main/resources
directory with your Slack webhook URL.
-
Use a Tool like Postman:
- Use a tool like Postman to send a POST request to
http://localhost:8080/sendSlackMessage
with a JSON payload containing the message you want to send.
- All the main code files are under
src/main/java/com/example/slackinteg
The application includes unit tests and integration tests to ensure functionality.
-
Unit Tests:
- Located in the
src/test/java/com/example/slackintegration/SlackServiceTest.java
.
- Located in the
-
Integration Tests:
- Located in the
src/test/java/com/example/slackintegration/SlackControllerTest.java
.
- Located in the
To run the tests, use Maven to execute the test phase.