How programmer gets his wife happy

2 min read

Don’t wanna get your wife angry just because of let her wait so long for a dinner? This program is for you. It’s a guide to build the simple application that automatically sends SMS to your wife at a specific time if you need to stay longer at the office.

zen8labs programmer

Get Twilio account

Register an account at: https://www.twilio.com, the service lets you send the SMS via REST API. During trial period, you could get 10$ — enough free messages; then you get charged with low fare later (~0.01–0.05$ for each SMS).

Setup Twilio

Now replace this command with your information above, replace + in the phone number with %2B.

curl -s -X POST “https://api.twilio.com/2010-04-01/Accounts/{ASID}/SMS/Messages.xml" -d From=”{SENDER}” -d To=”{RECEIVER}” -d Body=”{MESSAGE}” -u {KSID}:{KSECRET}
curl -s -X POST “https://api.twilio.com/2010-04-01/Accounts/{ASID}/SMS/Messages.xml" -d From=”{SENDER}” -d To=”{RECEIVER}” -d Body=”{MESSAGE}” -u {KSID}:{KSECRET}

Then run.

curl -s -X POST “https://api.twilio.com/2010-04-01/Accounts/ACa225474ed0119821diekxu29dvcc30bfe/SMS/Messages.xml" -d From=”%2B1914–595–1437" -d To=”%2B988999888" -d Body=”I'm busy today and might come home late. Love you my dear” -u SKe893oxkdks5c9bc4fea37b1de9f1de396:sJRZaW8fn2M0kalxielxmq9ZM15Z1czW3R
curl -s -X POST “https://api.twilio.com/2010-04-01/Accounts/ACa225474ed0119821diekxu29dvcc30bfe/SMS/Messages.xml" -d From=”%2B1914–595–1437" -d To=”%2B988999888" -d Body=”I'm busy today and might come home late. Love you my dear” -u SKe893oxkdks5c9bc4fea37b1de9f1de396:sJRZaW8fn2M0kalxielxmq9ZM15Z1czW3R

Got it? We are almost done.

Setup a cronjob

You can send SMS to your wife by only 1 command; now get it automated.

1. Create a file sweet_sms_to_darling.sh, put the command above.

#!/bin/bash # Script to send an SMS alert via Twilio. curl -s -X POST “https://api.twilio.com/2010-04-01/Accounts/ACa225474ed0119821diekxu29dvcc30bfe/SMS/Messages.xml" -d From=”%2B1914–595–1437" -d To=”%2B988999888" -d Body=”I'm busy today and might come home late. Love you my dear” -u SKe893oxkdks5c9bc4fea37b1de9f1de396:sJRZaW8fn2M0kalxielxmq9ZM15Z1czW3R

# Script to send an SMS alert via Twilio.

curl -s -X POST “https://api.twilio.com/2010-04-01/Accounts/ACa225474ed0119821diekxu29dvcc30bfe/SMS/Messages.xml" -d From=”%2B1914–595–1437" -d To=”%2B988999888" -d Body=”I'm busy today and might come home late. Love you my dear” -u SKe893oxkdks5c9bc4fea37b1de9f1de396:sJRZaW8fn2M0kalxielxmq9ZM15Z1czW3R

2. Get it executable, and run at 18:30 every day.

MacBook-Pro:twilio tom$ chmod 775 sweet_sms_to_darling.sh MacBook-Pro:twilio tom$ vi /etc/crontab

MacBook-Pro:twilio tom$ chmod 775 sweet_sms_to_darling.sh

MacBook-Pro:twilio tom$ vi /etc/crontab

Add this line, correct your file path, 18, 30 is the hour and minute triggers this bash script.

30 18 * * * ~/Desktop/twilio/sweet_sms_to_darling.sh

30 18 * * * ~/Desktop/twilio/sweet_sms_to_darling.sh

3. Save this file and add to cronjob. That’s all.

MacBook-Pro:twilio tom$ crontab /etc/crontab

MacBook-Pro:twilio tom$ crontab /etc/crontab

OK, now when your computer is up on 18:30, it automatically send the SMS to your wife.

Don’t worry about she get angry. Now work.

Please don’t put this job on server — it’s always up ?

It’s general idea of building the application, you could do it in others platform like Windows with BAT file and scheduled task. Another simpler and specific version for Mac is coming soon ? Part 2

Related posts

In this article we will examine the best approaches for ReactJS state management and demonstrate how to maintain control over the state of your application We shall see how ReactJS allows us to make a highly functionable app that benefits us to achieve our goals
5 min read
In a space where the environment is filled with of relational databases where data volumes are ever expanding the efficiency of SQL queries plays a pivotal role in maintaining optimal performance One of the key elements in achieving this optimization is the strategic use of indexes In this blog post we will engage with advanced indexing strategies in SQL exploring techniques that go beyond the
3 min read
Vue js a force in contemporary front end development presents an ideal mix of ease and capability Join us as we unveil its essential principles explore reactive data binding and navigate the creation of dynamic user interfaces with ease Whether you re an experienced developer or new to coding Vue js calls out assuring a smooth progression from simplicity to scalability Let s explore the
6 min read