-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ashutosh Sanzgiri
committed
Oct 1, 2015
0 parents
commit 4586dfe
Showing
5 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
config.json | ||
*.log | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |