Nomad500's avatar

Testing a dlr sms in laravel localhost

Hi have a question is possible to test a dlr for see what is a respons for the api sms server if i m in the localhost?

Because I must receive the status and other staff from this api, i see that my weebhook is triggered when I send sms, but I cant see anything in my url

So the code works

Thx for your help

0 likes
1 reply
LaryAI's avatar
Level 58

Yes, it is possible to test a DLR (Delivery Report) for an SMS API server in Laravel localhost. Here are the steps you can follow:

  1. Create a route in your Laravel application that will receive the DLR webhook. For example:
Route::post('/dlr', function(Request $request) {
    // Handle the DLR webhook here
});
  1. Use a tool like ngrok to expose your localhost to the internet. This will allow the SMS API server to send the DLR webhook to your localhost. You can download ngrok from https://ngrok.com/download.

  2. Start ngrok by running the following command in your terminal:

./ngrok http 80

This will create a public URL that will forward all requests to your localhost.

  1. Update the webhook URL in your SMS API server to use the ngrok URL. For example, if your ngrok URL is https://1234abcd.ngrok.io, then the webhook URL should be https://1234abcd.ngrok.io/dlr.

  2. Send an SMS message using the API and wait for the DLR webhook to be triggered. You should see the DLR data in the Laravel application's log or in the response to the API request.

Note: Make sure to secure your DLR webhook route by adding authentication and validation to prevent unauthorized access and ensure the data is valid.

1 like

Please or to participate in this conversation.