code: def hook():
      
      repo_id = request.json['id']
  
      github = GitHubAPI(user_id=current_user.id)
      repos = github.account.extra_data['repos']
  
      if repo_id not in repos:
          abort(404)
  
      if request.method == 'DELETE':
          try:
              if github.remove_hook(repo_id, repos[repo_id]['full_name']):
                  db.session.commit()
                  return '', 204
              else:
                  abort(400)
          except Exception:
              abort(403)
      elif request.method == 'POST':
          try:
              if github.create_hook(repo_id, repos[repo_id]['full_name']):
                  db.session.commit()
                  return '', 201
              else:
                  abort(400)
          except Exception:
              abort(403)
      else:
          abort(400)
docs: Install or remove GitHub webhook.