Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- ใทใ
- ์๋ฐ์คํฌ๋ฆฝํธ#์กฐ๊ฑด๋ฌธ#๋ฌธ์์ด
- ํท๊ฐ๋ฆฐ๋ค~
- ์๋ฐ์คํฌ๋ฆฝํธ#JS#var#let#const#undefined#null
- ๋ด์ฅ๊ณ ์ฐจํจ์
- react
- redux์ํ์ ์ง
- Beesbeesbees
- js
- toString#String
- variable#function
- JS#3์ผ์ฐจ๋ฌ๋ฆฌ์#์ด๋ฐ์ธ๋ฐ#์๊ฐ๊ธ๋ฐฉ~
- User Flow
- CSS
- https://www.daleseo.com/js-array-slice-splice/
- ์๋ฐ์คํฌ๋ฆฝํธ
- cmarket
- ์๋ฐ์คํฌ๋ฆฝํธ#JS#slice#splice
- dom
- https://developer-talk.tistory.com/299
- https://lo-victoria.com/introduction-to-redux-toolkit-for-beginners
- for~in/for~of
- UX
- removeCookie
- UI
- ๋ ธ๋๊ต๊ณผ์
- children vs childrenNodes
- slice/splice/split
- @redux-toolkit
- https://dasima.xyz/%EC%9E%90%EB%B0%94%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EC%A0%9C%EA%B3%B1-math-pow-%EA%B3%84%EC%82%B0/
Archives
- Today
- Total
Daily Front_Minhhk
[springboot] slack web hook_ ์ฌ๋์นํ ์ง์ ๋ณธ๋ฌธ
Code๊ฐ๋ฐ์ผ์ง/springboot
[springboot] slack web hook_ ์ฌ๋์นํ ์ง์
Minhhk 2024. 12. 8. 13:19๐ก ์ฐ์ ์๋ฆผ ๋ฐ์ ์ฑ๋์ ์ฌ๋์ ๋ง๋ค์
๐ก #hooktest ์ฑ๋ ์ฐํด๋ฆญ → ์ฑ๋ ์ธ๋ถ์ ๋ณด ๋ณด๊ธฐ
์๋๋ก ๋ด๋ ค ์ด๋ฆ, ์ด๋ฏธ์ง ๋ณ๊ฒฝ!
๐ก SpringBoot ์ฝ๋
import com.slack.api.Slack;
import com.slack.api.webhook.Payload;
import org.springframework.stereotype.Component;
import java.io.IOException;
@Component
public class SlackHttpClient {
public void send(String message) {
try {
Slack instance = Slack.getInstance();
Payload payload = Payload.builder()
.text(message)
.build();
instance.send("SLACK WEB HOOK URL ์
๋ ฅ", payload); // webhook URL
} catch (IOException e) {
throw new RuntimeException(e);
}
}}
SlackHttpClient ๋ง๋ค์ด์ ์ฌ์ฉํ๊ณ ์ถ์ ์ปจํธ๋กค๋ฌ๋ ์๋น์ค๋จ์์ ํธ์ถํด์ ์ฌ์ฉ ํ๋ฉด๋๋ค.
์๋ฆผ ๋ด์ฉ์ String.format ์ด๋ StringBuilder ๋ก ์ฌ์ฉํด์ ์ปค์คํ ํ๊ฒ ์ฌ์ฉํ์.
@RestController
@RequiredArgsConstructor
public class SlackController {
private final SlackHttpClient slackHttpClient;
@GetMapping("/api/slack/alarm")
public String getAlarmTest() {
return slackHttpClient.send("๋ฉ์ธ์ง ๋ด์ฉ");
}
}
→ ์๋ฆผ ํ ์คํธ ๊ฒฐ๊ณผ