Receive SMS notification everytime a file is created in Dropbox folder


Have you ever need some kind of notification be it via SMS or emails during some alarming conditions? Here is a real case study after meeting my client recently.

A little background:- this client need a solution whereby an automation will notify a group of stakeholders in case of a trigger happen. The trigger will happen when their existing system create a text file in a folder. The alarming situation will depend on what is the content in the text file.

Assume that the text file will be created in c:\alarmsystem\ and the text file will contain either “red”, “blue” or “green” text. An SMS notification need to sent immediately when the content is “red”. All this while, they do it quite manually whereby a real human open the text file, read the content, and if required will manually send SMS to some stakeholders.

The question:- can we automate the whole process of this notification without human intervention? Yes we can.

The automation can be done in many ways, but the simplest that I can think of is using a combination of Dropbox webhooks, a web server, and API to SMS engine.

Cost consideration:-

Dropbox – it is available for free for a limited storage size, but if you need bigger storage consider to sign up for individual plan at $9.99/monthly.

Web server – once again, there is not cost if you can grab a copy LAMP, install it on your existing PC. But if the application is so critical, consider to subscribe to a cloud VM and install LAMP on it. Cloud availability is normaly at 99.9999%, it is cheap and far better than your PC. Check out offering from TM One Azure Stack.

SMS engine – pick any SMS engine, but TM Infoblast SMS is quite good which they are postpaid, easy to use and API ready. Checkout my article on using TM Infoblast SMS API. The cost is only RM0.12/SMS.

Step 1

Follow this guideline from Dropbox in order to set up a webhook script. The simplest example such as:

	echo $_GET['challenge'];
//do your stuff here

Access token can be generated from Step 2. Put the script to publicly accessible web server such as https://www.yourdomain.com/dropbox_webhook.php. You will need this URL in Step 2.

Step 2

Signup to Dropbox, download the desktop application and set the sync folder to C:\alarmsystem\ (following the above assumption). Then go to App Console to create your Dropbox app and register webhook URL. Choose Dropbox API, Full Dropbox access, and put a name to your app.

In the next page after you submit, there is a button to generate access token. Generate one, copy and put it into your webhook script in Step 1. Get the URL from Step 1, add it into the list of Webhook URIs.

Now the alarm system will save a text file in c:\alarmsystem\ and Dropbox will automatically notify your script at Step 1. What should you do now is to write some code to check on what file was newly created, read the content and send the SMS.

Good luck and should you need any assistance, please PM Tepi.

About Author Mr.Bazz

Hi thanks for dropping by. Please share the content if you think there is someone who will appreciate it.

Leave A Comment

Your email address will not be published. Required fields are marked *