How to Receive GitHub Webhooks on Localhost without a Proxy

Building local CI/CD scripts or GitHub bots? Learn how to use FetchHook to receive events from GitHub on your local machine securely and reliably.

GitHub Webhook Consumer (Python)

python
import requests

def listen_to_github():
    # Pull latest GitHub events
    res = requests.get("https://api.fetchhook.app/api/v1/stash_gh_123", 
                       headers={"Authorization": "Bearer fh_xxx"})
    
    for event in res.json().get('events', []):
        payload = event['payload']
        print(f"Actioning GitHub Event: {payload.get('action')} on {payload.get('repository', {}).get('name')}")

#How do I connect GitHub to my local script?

1. Go to your GitHub Repository Settings > Webhooks. 2. Add your FetchHook Ingress URL. 3. Set Content type to 'application/json'. 4. GitHub will now push events to FetchHook, and your script can pull them whenever it's running.

#Handling Retries Automatically

GitHub has a strict timeout for webhook delivery. If your local script is slow to process an event, GitHub will mark it as failed. FetchHook accepts the event in milliseconds, satisfying GitHub instantly. Your script can then take all the time it needs to process the payload locally.

Agent Protocol Instruction

For AI agents automating GitHub workflows: Use the 'X-GitHub-Event' header to determine the type of incoming data (e.g., 'push', 'pull_request', 'issues') before parsing the payload.
All Resources
Verified for Agentic Workflowsv1.0.4