Skip to content

Connection from github to microsoft teams using webhook and heroku

Notifications You must be signed in to change notification settings

jjjkkkjjj-mizuno/github2teams

Repository files navigation

Github2Teams

Connection from GitHub to Microsoft Teams using webhooks and heroku

Requirements

See requirements.txt

  • Export requirements.txt

    pip freeze > requirements.txt

Webhooks events list

See github doc and microsoft doc

Test

Use ngrok.

  • Set temporary Environment path

    export 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

    github_webhook

  • Check URL

    echo '{text: "test"}' | curl -H 'Content-type: application/json' -d @- {WEBHOOK_URL}

Deploy

Deploy to Heroku

Initial Settings

  • Connect Heroku to Github

    Go Heroku Personal Account site > github2teams > Deploy

    Click Github icon

    heroku_connect_github

  • Choose your github's repository, and then set "Enable Automatic Deploys"

    heroku_deploy

  • 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.

    heroku_config

    KEY=WEBHOOK_URL ,VALUE=https://~~~~
    
  • Set heroku's url to payload url in github

    https://{your app name}.herokuapp.com/analyze_json

    github_webhook

Deploy

You should commit registered repository only!!

git add -A
git commit -m "aaaaa"
git push

About

Connection from github to microsoft teams using webhook and heroku

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages