# Teams Webhook 教學
###### tags: `API相關`
1. 安裝 pymsteams
2. 到 teams 建一個團隊,團隊新增的頻道,選擇旁邊...
3. 進入 ... 後選擇連結器,新增 Webhook
4. 新增後進入設定 webhook
5. 設定 webhook 名稱和相片,然後建立,即會產生 URL
6. 將 URL 寫到 pymsteams.connectorcard 內
7. 填寫 myTeamsMessage.text 內容
8. 傳送即可推播到 teams
```
# 安裝 pymsteams 套件
pip install pymsteams
```
```
# 使用方式
import pymsteams
# 建立 Teams 連接器後,掛載 Webhook URL
url = 'Webhook URL'
# 建立 connectorcard object 並給予 Webhook URL
myTeamsMessage = pymsteams.connectorcard(url)
# 建立 Title
myTeamsMessage.title("This is my message title")
# 建立 Text
myTeamsMessage.text("this is my text")
# 建立 Link Button
myTeamsMessage.addLinkButton("This is the button Text", "https://github.com/rveachkc/pymsteams/")
# 傳輸給 Teams channel
myTeamsMessage.send()
```
參考資料:https://github.com/rveachkc/pymsteams