You are here

How to Build a Bitcoin SMS API in Node

Bitcoin’s volatility is well documented. Prices have ranged from the infamous 10,000 BTC pizza purchase of 2010 (equivalent to around $25 at the time), to its all-time high of $1,242 for a single Bitcoin in December 2013. At the time of writing, 1 BTC was valued at just a shade under $270.

This tutorial by Randall Degges on the Stormpath Blog guides followers through building a publically available API service that sends users the current Bitcoin price at each API call. This service could be useful for independent retailers that accept BTC for goods or services, or anybody looking to buy or sell Bitcoins.

The service involves a fairly simple process of requesting the BTC price and delivering that data to the user via SMS. However, the process is complicated slightly by the inclusion of a payment feature that charges third-party developers 2c per successful API call. The application is built in Node and the tutorial begins with setting up Twilio to send the SMS messages, including buying a phone number to send messages from (this typically costs around $1 per month + 1c per SMS you send).

The author then sets up a Stripe account to handle credit/debit card or Bitcoin payments. Followers are then guided through setting up a Stormpath account for Authentication and API Key management, which removes the need to run a database for user data.

Once you have created a new API key, set up a new Stormpath Application with a suggested name of BTC SMS. Now the coding begins, starting with a minimalist Express.js application for structure and using Node template engine Jade for the View. The rest of the tutorial covers creating the static assets, setting up the application and defining the routes.

All the code is provided in the tutorial, as is a link to a screencast video covering the same content. This post is a fantastic example of how simple it can be to use API services to speed up development time and launch a legitimate API company.

Be sure to read the next Application Development article: How to Build an Events Database Using the ParseHub API, Python & Flask

Original Article

Build an API Service in Node.js With Stormpath, Twilio and Stripe

 

Comments