Webhook testing¶
Webhook testing is the process of validating and debugging HTTP callbacks during local development. Since a local development environment is typically inaccessible to the public internet, external services (such as GitHub or Slack) cannot send webhook payloads to a local server.^[400-devops-02-os-and-linux-basics-network-ngrok.md]
To solve this, developers use tools like ngrok to create a temporary server that exposes local ports to the internet.^[400-devops-02-os-and-linux-basics-network-ngrok.md]
Tools¶
ngrok¶
ngrok is a tool often used to test webhooks by creating a secure tunnel to a local machine.^[400-devops-02-os-and-linux-basics-network-ngrok.md] It provides a public domain (e.g., https://1bee-210-66-180-104.jp.ngrok.io) that forwards traffic to a specified local port, such as 8080.^[400-devops-02-os-and-linux-basics-network-ngrok.md]
Usage¶
To initiate a tunnel that forwards public traffic to a local server running on port 8080, the following command is used^[400-devops-02-os-and-linux-basics-network-ngrok.md]:
[ngrok](<./ngrok.md>) http 8080
The tool provides a web interface, typically accessible at http://localhost:4040, which allows developers to inspect, replay, and modify incoming requests.^[400-devops-02-os-and-linux-basics-network-ngrok.md]
Common Use Cases¶
Webhook testing is frequently required when developing applications that rely on event-driven notifications from external platforms^[400-devops-02-os-and-linux-basics-network-ngrok.md]: * GitHub Webhooks: Validating code repository events^[400-devops-02-os-and-linux-basics-network-ngrok.md]. * Chat Bots: Developing bots for platforms like LINE, Slack, or Telegram^[400-devops-02-os-and-linux-basics-network-ngrok.md].
Sources¶
^[400-devops-02-os-and-linux-basics-network-ngrok.md]