Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh Sanzgiri committed Oct 1, 2015
0 parents commit 4586dfe
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
config.json
*.log
node_modules/
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Dash SMS

## Setup

```
$ npm install
```

Copy config.json.sampl to config.json and update with your info.

Follow the [node-dash-button](https://github.com/hortinstein/node-dash-button) instructions to find your dash-button id.

Run it using:

```
$ sudo node index.js
```

Or install it globally and run

```
$ cd /path/to/dash-sms
$ sudo npm install . -g
$ sudo dash-sms
```

Press your dash button and you should receive an SMS on the phone you set up.

## Acknowledgements

Edward Bensen (for his article on Medium that inspired this), Alex Hortin (for his node-dash-button module), Dan Nawara (for his dashgong app, from which I borrowed heavily)

14 changes: 14 additions & 0 deletions config.json.sampl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"button": {
"id": "00:11:22:33:44:55" // enter the MAC address of your Dash button here
},
"twilio": { // these are your twilio credentials
"sid": "ABcdefABcdefABcdefANcdefABcdefABcd",
"token": "abcdefabcdefabcdefabcdefabcdefab"
},
"message": {
"from": "9711234567", // this is the number you got from twilio
"to": "5037890000", // this is the number to which you want to send an SMS
"body": "Greetings from Dash!" // this is the message to send when the Dash button is pressed
}
}
26 changes: 26 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /usr/bin/env node

var config = require('./config');
var dash_button = require('node-dash-button');
var dash = dash_button(config.button.id);

// Twilio Credentials
var accountSid = config.twilio.sid;
var authToken = config.twilio.token;

//require the Twilio module and create a REST client
var client = require('twilio')(accountSid, authToken);

dash.on("detected", function (){

console.log("Dash button detected!");
client.messages.create({
to: config.message.to,
from: config.message.from,
body: config.message.body,
}, function(err, message) {
console.log(message.sid);
});

});

22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "dash-sms",
"version": "0.0.1",
"description": "Amazon Dash button to send SMS",
"main": "index.js",
"dependencies": {
"node-dash-button": "^0.1.1"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"twilio",
"dash"
],
"bin": {
"dash-sms": "index.js"
},
"author": "Ashutosh Sanzgiri",
"license": "MIT"
}

0 comments on commit 4586dfe

Please sign in to comment.