기타/Python → Webhook

slack에 Webhook 추가

비번변경 2021. 5. 16. 01:43

방법

1. Slack 워크스페이스 및 채널 생성

2. slack에 imcoming-webhook 추가

Webhook
서버에서 어떠한 작업이 수행되었을 때 해당 작업이 수행되었음을 HTTP POST로 알리는 개념

 

2.1. 슬랙 워크스페이스 왼쪽 메뉴 > Settings & administration > Manage apps

slack Manage apps

2.2. 상단의 검색란에서 incomming webhook 검색 후 선택

slack app directory

2.3 webhook 추가

click 'add to stack' button

2.4. 메세지를 전송할 채널 선택

setting channel to post

2.5. 추가 완료

webhook 추가 완료

2.6. 테스트

curl -X POST --data-urlencode "payload={\"channel\": \"#test_alarm\", \"username\": \"webhookbot\", \"text\": \"This is posted to #test_alarm_bespin and comes from a bot named webhookbot.\", \"icon_emoji\": \":ghost:\"}" <WEBHOOK_URL>

webhook 테스트

728x90