News

Programmer Retargets AWS IoT Button for ACLU Donations

In the current U.S. political environment, donations to the American Civil Liberties Union (ACLU) have reportedly skyrocketed. And now a developer has programmed an IoT button from Amazon Web Services Inc. (AWS) to make the donation process even easier.

As we reported last month, the AWS IoT button is part of the company's AWS IoT Button Enterprise Program that provides physical buttons -- based on the popular Amazon Dash Button used for commercial purposes such as reordering supplies -- for adding IoT device functionality.

Now in a limited preview, the IoT button can be used to automatically trigger cloud-based services. AWS said the programmable device can serve as an onramp to use services such as AWS IoT, AWS Lambda, Amazon DynamoDB, Amazon SNS without having to resort to writing device-specific code.

But developer Nathan Pryor had other ideas for the button.

A friend's comment got him to thinking "why reserve that instant gratification for physical goods? Why not push a button and do some real good?" he said in a blog post.

Using the AWS Lambda service -- for "serverless" computing in which code can be executed in response to an event -- he cooked up a Python script, using the Mechanize library.

"Lambda lets you run small programs like this that don't need a full time server -- you literally pay only for the milliseconds that your script runs," Pryor explained. "When it's triggered, the script loads up the donation page, fills the fields with my name, address, and credit card info, then submits it. If it's successful, it sends me a text message to let me know."

The task was probably more complex than other uses the IoT button has been put to, as he couldn't find an API to automate the ACLU donation process, forcing him to analyze the organization's donation form in order to programmatically fill it out.

The effort was further complicated because an associated iPhone app that's supposed to help connect and configure the button couldn't complete the donation process.

"After hours of frustration and troubleshooting, I eventually got the IoT button registered manually and linked it to the script I'd written," he said. "Another test, another $5 to the ACLU."

However, it all works now, and the button is adorned with a professional-looking graphic that Pryor printed out and attached.

"The button resides near my laptop now, every press sending another $5 into the fight," he said. "Sure, I could set up a recurring donation every month, but then there's not the tactile thrill of the press and I wouldn't have learned my way around this technology."

Pryor put the code he developed up on GitHub for others to use at their own risk if they want, though he makes no guarantees as to suitability or security.

Besides the blog post, more information about Pryor's creation is available in a video.

About the Author

David Ramel is editor in chief of Visual Studio Magazine and Application Development Trends Magazine.

Featured