Twilio Hackathon: cli chat app (7 Part Series)
A terminal based chat application using twilio's programmable chat api. I also added some extra features like 2FA for registration using the Authy api and text messaging using the sms api.
Since this is a terminal based app, you'll have to run it locally.
A cli chat application made with Python & Twilio's Programmable Chat REST API.
How it works
This application provides a command line interface where registered users can chat on different channels.
- User registration with 2FA using Twilio's Authy API
- Terminal interface
- Chat using Twilio's Programmable Chat API
- Create and delete channels using the
- Receive system notifications when your username is @mentioned in a channel
- Send sms to teammates right from the chat interface using the
- Python 3
- Linux / MacOs terminal
- ngrok so we can expose our local port 8000 online for the chat webhook
Twilio Account Settings
Before we begin, we need to collect all the config values we need to run the application:
I integrated the chat api with the sms api and authy to achieve the functionality.
The key thing I learned was multi-threading with Python. This is a feature I had never used before but I had to learn about it to have the server running and listening for connections from the webhook in the background and still keep the chat interface functional in the foreground without blocking.
As for issues, my laptop died along the way so I went like a week without making progress. I would have done a bit more if it weren't for this but oh well 🤷🏽♂️.
This app has only been tested in unix terminals (linux & mac). I don't have access to a windows machine so I was not able to test it for windows.
You cannot run two sessions of this app at the same time because the port 8000 will already be in use.
To test out chatting between different users, you can set up one of the starter apps with the same credentials in the
.env so that the app is connected to the same service.
Below is an example of a chat session between two web clients and the terminal client.
Claim your page on DEV before someone else does
Level up every day