파이썬
send message to slack channel with python
청룡동사는연우
2023. 8. 5. 15:39
목차
테스트 목표
- python 으로 slack channel 에 message push
1. 슬랙 app 생성
설치가 진행되면 app token 이 생성됨
하면 channel 에 bot 이 초대됨
2. python 코드 작성
slack sdk 설치
pip install slack_sdk
import slack_sdk
my_token='my-app-token'
client=slack_sdk.WebClient(token=my_token)
client.chat_postMessage(channel='#test',
text='hello world')
간단한 코드 작성
메세지 디자인이나 여러 기능을 제공한다고 하는데 어차피 로그만 가져올꺼라
3. 테스트 결과 확인
참고
https://getitall.tistory.com/entry/Python-슬랙-Slack-메신저-봇-만들기-코드-포함-초간단-코딩