So, I built a small Flask app while tinkering with Twilio API’s called BizzyBot. It’s a SMS bot that provides requests/responses for your personal business card information. It was fun, quick, and easy to set up using the Twilio Console, Python, ngrok, and Twilio docs. It’s amazing how far they’ve gone just building out their documentation and having other users built out their own getting started guides. The main block, “bizzy”, parses through a text request and runs the “getContent” method to choose which response to send back.
from flask import Flask, request, redirect from twilio.twiml.messaging_response import MessagingResponse app = Flask(__name__) # Get the business card info to text back def getContent(msg): msg = msg.lower().strip() bizinfo = "" if "resume" in msg: bizinfo = "https://www.dropbox.com/s/edf1u3pjp999ks9/AakashDesai_Resume.pdf" elif "phone" in msg: bizinfo = PHONE_NUMBER elif "email" in msg: bizinfo = EMAIL elif "github" in msg: bizinfo = "http://www.github.com/aakashhdesai" elif "blog" in msg: bizinfo = "http://aakashdesai.blog" elif "linkedin" in msg: bizinfo = "http://www.linkedin.com/in/aakashhdesai" else: bizinfo = "Welcome to Aakash's SMS Biz Card! Please reply with one of the following: resume, phone, email, github, blog, linkedin" return bizinfo @app.route('/', methods=['GET','POST']) def bizzy(): # Get the body of the incoming text request body = request.values.get('Body', None) # Start a Twilio response object resp = MessagingResponse() # Reply back to the text request replyText = getContent(body) resp.message(replyText) return str(resp) if __name__ == '__main__': app.run(debug=True)
Going through the normal offline to online workflow, I found that tech folks found the exchange fun…though new. Fun experiment and I’m not sure how it’ll go with people who don’t already understand the tech.
In the future, I’d like to build out more of a chat workflow and maybe apply it to the blog somehow. If you’re interested in checking out the app SMS workflow, ping me via GitHub or channels and will send over the phone number!