Echo Dot (3rd Gen) - Smart speaker with Alexa - Charcoal

Use your voice to play a song, artist, or genre through Amazon Music, Apple Music, Spotify, Pandora, and others. With compatible Echo devices in different rooms, you can fill your whole home with music.

Buy Now

Wireless Rechargeable Battery Powered WiFi Camera.

Wireless Rechargeable Battery Powered WiFi Camera is home security camera system lets you listen in and talk back through the built in speaker and microphone that work directly through your iPhone or Android Mic.

Buy Now

Node.js Chat App to SMS

0
288


David Davis

Summary: This is a how-to Node.js socket.io chat app to SMS using Twilio API. Feel free to jump to the repo to get you started.

So I recently was looking to integrate a chat app for a small business client. I knew they wouldn’t want to budget a third party app like Intercom, and so I searched for something simple; I just wanted a chat app on the client’s website that would SMS my client’s phone. I admittedly didn’t do an in depth search, but from what I found it seemed most 3rd party applications charge $15/month on the low end to accomplish this. Knowing this isn’t a very complex application I set out to build what I needed.

The only real limiting factor from what I found when trying to ping a mobile carrier is that you can’t just send an RPC from Node.js without sending it from an SMS number. And thankfully Twilio has a solution you can use called Programmable SMS. To get started, you must purchase a number through them, and by default they give you a number with a random area code. At the end of the day, when you get your app up and running, it’s really pennies on the dollar to use the Twilio service, and for a small company this beats paying a 3rd party app a monthly $15.

First, where to host this code? Well, you need a place that allows persistant connections. I’m a fan of now.sh, but they don’t support persistant connections that is needed with websockets. Because I used to work for Google I’m a fan of Google Cloud Platform, and so Cloud Functions won’t work, App Engine does allow persistant connections. Easy enough, BUT, after only a month of running this app on App Engine, I got a bill for ~$150. WHAAAAAT! Yeah, the open socket connection outgoing calls from the server meant I was getting charged 24 hours a day. Screw that obviously, I got a small business to run. So I jumped over to Heroku, and luckily they don’t charge an arm and a leg for this service. I recommend using Heroku.

Enough background, here’s what your app should look like when your done:

I’ve implimented the following using react chat UI called react-chat-window. You can also use react-chat-widget. Both are minimalist UIs and both are great. The code for react-chat-window looks like this:

The above front-end code can live anywhere, I’m using now.sh. But for the backend code that’s on Heroku, and that code looks like this:



Read More

LEAVE A REPLY

Please enter your comment!
Please enter your name here