Coder Social home page Coder Social logo

dash-button's Introduction

Amazon Dash-Button

Blank Dash

This simple script allows the use of Amazon dash button to send an slack message to slack. In order to do so, I am using the node-dash-button module.

Setup


Follow the node-dash-button instructions to find your dash-button id.

Installation Instructions

Get the libpcap dependency:

$ sudo apt-get install libpcap-dev

Clone this repository:

$ git clone https://github.com/imartinezl/dashbutton.git

Start a npm project:

$ npm init

Install the nodejs modules dependencies included in package.json:

$ npm install

First Time Dash Setup

Follow Amazon's instructions to configure your button to send messages when you push them but not actually order anything. When you get a Dash button, Amazon gives you a list of setup instructions to get going. Just follow this list of instructions, but don’t complete the final step (#3 I think) Do not select a product, just exit the app.

Find Dash Address

To find a dash on your network, run the following from the node-dash-button directory in node_modules:

$ cd node_modules/node-dash-button
$ sudo node bin/findbutton

It will watch for new arp and udp requests on your network. There may be several such requests, so press it a few times to make sure. Copy the hardware address as shown below, and make a note of the protocol used.

hw address

Note: If your computer has multiple active network interfaces, findbutton will use the first one listed. If you need to overwrite this setting, pass your preferred interface as the first argument, such as node bin/findbutton eth6.

Define Slack Incoming Webhook

Go to your Slack Workspace >> Administration >> Manage Apps >> Browse:

  • Search for: "Incoming WebHooks" and add it*

Then go to Manage >> Custom Integrations >> Incoming WebHooks:

  • Copy the "Slack webhook" under the Setup Instructions

Send Message to Slack

Create a .env file specifying the ADDRESS, the SLACK_WEBHOOK_URL and the desired MESSAGE:

SLACK_WEBHOOK_URL='https://hooks.slack.com/services/*********/*********/*********'
ADDRESS='**:**:**:**:**:**'
MESSAGE='Come and join us!! Meeting with food :cake:'

Run the index.js:

$ sudo node index.js

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.