Build a stock quote SMS bot with Twilio and TypeScript
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.
Company
Twilio
Date published
March 29, 2021
Author(s)
Phil Nash
Word count
1827
Language
English
Hacker News points
None found.