Connection from GitHub to Microsoft Teams using webhooks and heroku
See requirements.txt
-
Export requirements.txt
pip freeze > requirements.txt
See github doc and microsoft doc
Use ngrok.
-
Set temporary Environment pathexport FLASK_APP=main.py export FLASK_DEBUG=1
-
Set Deployed Environment path
Note that
WEBHOOK_URL
is from Teams' webhook URL not github's payload URL.export WEBHOOK_URL='https://~~~'
-
Get local's global address by ngrok
ngrok http {port number}
e.g.) Output is below (
port number
=8000)Session Status online Session Expires 7 hours, 59 minutes Web Interface http://~:4040 Forwarding http://~.ngrok.io -> http://localhost:8000 Forwarding https://~.ngrok.io -> http://localhost:8000
-
Set
https://~.ngrok.io
/analyze_json` using above url to payload url in Github -
Check URL
echo '{text: "test"}' | curl -H 'Content-type: application/json' -d @- {WEBHOOK_URL}
Deploy to Heroku
-
Connect Heroku to Github
Go Heroku Personal Account site > github2teams > Deploy
Click Github icon
-
Choose your github's repository, and then set "Enable Automatic Deploys"
-
Set Environment Path
Go Heroku Personal Account site > github2teams > Settings > Config Vars
Click "Reveal vars", and set specific path's information.
Note that environment path can be set by Heroku CLI too.
KEY=WEBHOOK_URL ,VALUE=https://~~~~
-
Set heroku's url to payload url in github
https://{your app name}.herokuapp.com/analyze_json
You should commit registered repository only!!
git add -A
git commit -m "aaaaa"
git push