Content Deep Dive
Build a stock quote SMS bot with Twilio and TypeScript
Blog post from Twilio
Post Details
Company
Date Published
Author
Phil Nash
Word Count
1,827
Language
English
Hacker News Points
-
Source URL
Summary
A Node.js application using Express, the Twilio Node package, and the Finnhub API is built to reply to incoming SMS messages with stock quotes. The application requires a Twilio account, a Twilio phone number, Node.js installed, ngrok for tunneling, and a Finnhub API key. A configuration file manages environment variables for the API key. The `getQuote` function makes requests to the Finnhub API using the got package and returns a Promise that resolves to an object of type Quote. The application uses TypeScript to compile the code and send back data about the stock prices in response to incoming SMS messages, comparing current price to previous close and displaying an emoji based on whether it is higher or lower.