The first thing you need to do is turn on 'Read Received' from the navigation drawer. You can do it by following this guide.
You need to create a script as suggested in the WebHook Example Script section of the API page in your Admin Panel and upload it to your server. Just provide its URL in Add WebHook form on the API page and hit the Save button. Now, whenever you will receive a message on your device that script will be executed automatically.
Remember, you can't execute the WebHook script directly. It won't work.
Here is a detailed example of how to add it.
 Login to your Admin Panel and open the API page. You will section called "Webhook Example Script" as shown in the screenshot below.
 Just copy all the text inside this section. Now create a PHP file named "hook-example.php" at the root of your server, and paste all the text you copied from that section into this file.
 Now to make it work you have to add the URL of the file we created. Just login to your Admin Panel and open your API page. You will see a section called "Add Webhook for received messages". Just enter the URL for the "hook-example.php" into the form and press save as shown below. It is recommended to provide a secure URL (starts with https://) if your server URL is also a secure URL.
 Now you have to turn on the "Read Received" from the mobile app as shown here if you haven't done so.
Now, Whenever you receive the message on your device which is registered to the SMS Gateway account where you added this webhook, the webhook script will be called automatically.