Bot development with local tunneling¶
Bot development with local tunneling is a technique that allows developers to expose a local development environment to the public internet. This is typically required when developing chatbots or applications that rely on webhooks, as services like GitHub, Slack, Telegram, or LINE need a public URL to send HTTP requests (callbacks) to the developer's local machine.^[ngrok.md]
By establishing a secure tunnel to a public endpoint, developers can test and debug integrations without needing to deploy code to a remote server.^[ngrok.md]
Key Tools¶
ngrok¶
ngrok is a commonly used utility for this purpose, available for free.^[ngrok.md] It acts as a "temporary server," creating a secure tunnel from a public URL to a specified port on the local machine (e.g., port 8080).^[ngrok.md]
This tool is frequently used to test webhooks and callbacks for various platforms, including:
- GitHub Webhooks^[ngrok.md]
- Slack Bots^[ngrok.md]
- Telegram Bots^[ngrok.md]
- LINE Bots^[ngrok.md]
Usage Workflow¶
The standard workflow involves installing the tool, authenticating the account, and starting the tunnel.
1. Installation¶
ngrok can be downloaded directly from the official website or installed via package managers like Chocolatey on Windows.^[ngrok.md]
2. Execution¶
Once installed and authenticated, the user specifies the local port to forward. For example, to forward traffic from the public internet to a local server running on port 8080, the command is:
[ngrok](<./ngrok.md>) http 8080
Upon starting, ngrok provides a public URL (e.g., https://1bee-210-66-180-104.jp.ngrok.io) that routes traffic to the local host.^[ngrok.md]
Sources¶
^[ngrok.md]