Simulating love with Node, Express, and Bandwidth
It’s that time of the year again… A simple stop to the local pharmacy reminds you that you’re all alone. Well, fret not you unrequited lover, you. We here at Bandwidth love you and that’s why we wrote Heart-Text. Heart-Text is a simple NodeJS application written with the Express framework that shares the love. Simply text or call 732-iLoveBW (732–456–8329) and Bandwidth will respond with a Whole Lotta Love.
Now that I feel loved, how does this work?
Handling Text Messages
Everyone ❤s getting picture messages from the one they ❤. So heart-text will send a lovely stock-image when certain keywords are matched. But at it’s ❤, it mainly just auto-responds to the text.
Putting this all together with express and node, all you need to do is extract the relevant query parameters and build the message to send to the Bandwidth REST API
How to respond to incoming text messages using the REST API
Handling Incoming Calls
But what if you want to call your computer lover? Heart-Text handles that equally as well using BXML instead of the REST API. Use BXML to play audio on incoming call Building the BXML and response is a few lines of code within the call handle express middleware
Respond to incoming calls with BXML
Want to build your own heart-text bot?
All you need is a Bandwidth account and then download the Repo hosted in Github.