ngrok
This guide walks through how to get ngrok up and running on your machine. To test it out with Telnyx webhooks, you’ll need to sign up. If you’d like to test out your ngrok instance by receiving a webhook associated with an API-enabled phone call, jump to our Receiving Webhooks in Voice API after you complete these steps! ngrok is a popular tunneling tool used to expose a locally running application to the internet. You can download it for free with all of the functionality you need here. This is useful for receiving webhooks to your local applications for testing. For the sake of this tutorial, we’ll assume that your local application is running locally on port5000. Now you’ll need the ability to send a request to that port from Telnyx. You can easily do this using ngrok when developing your application.
Sign up for ngrok and follow the setup and installation steps to get up and running. The final step in the process is to start an HTTP tunnel to your application. The instructions specify $ ./ngrok http 80, which will tunnel traffic to port 80 on your machine. As our application is running on port 5000, you should use that instead: $ ./ngrok http 5000.
When you run this command, you should see output similar to the following:
ngrok forwarding address
The forwarding addresses will be different for you, but they should still point tolocalhost:5000. Copy the https forwarding address, as you’ll need it to configure your Mission Control Portal.
Messaging With ngrok
For messaging, webhooks set the webhook URL on your messaging profile from the Telnyx Portal Messaging dashboard. Edit your Messaging Profile by clicking the “Basic Options” button [✎]. Select the “Inbound” section and paste the forwarding address from ngrok into the Webhook URL field. Append/webhooks to the end of the URL to direct the request to the webhook endpoint in your local application.