Hey guys I was hoping I could come here to ask for input on how to approach sending a user a text message and then waiting for a reply using twilio, flask, and redis rq. In my research, I’ve found that the process requires using a background worker to either continuously check for a reply or, if designed properly, check a database field for a certain status for example.
My question is, with the tools I mentioned before, what is the best way of achieving this functionality? As someone who hasn’t done asynchronous task management, I’m having trouble understanding where does a task scheduler like redis rq come into the equation of waiting for a user’s response to a sms text.
2
Answers
I work at Twilio and also code in Python. I never used redis queue but I’ve used Redis Pub/Sub in the past and this seems like a good approach in my opinion. I’ve found this blog post from last year showing how to create a simple sms micro service with flask, redis pub/sub and twilio. Let me know if this is helpful or if redis queue is mandatory so I can help you better.
I personally wouldn’t use a queue approach here, a database approach, e.g. a key/value store for quick lookup (I’ve used DynamoDB for this quite a lot but normal Redis works too), would make more sense in my eyes.
The flow would be similar to this: