Writing Twiml based on user messages

First post on here. Im working on an application in python using the twilio voice api. Id need to be able to create twiml xml data based on user messages. Hence twiml creation and hosting programmatically on the fly. Is there anyone here that can point me in the right direction. For all i know twilml bin doesnt allow that. Thank you

Answer

Twilio developer evangelist here.

You are right that TwiML Bins don’t allow to generate dynamic responses (outside of some light templating). However, you are building with Python, so you can build a web application that responds to Twilio webhooks with dynamically generated TwiML.

I’d recommend working through this tutorial on receiving and responding to incoming SMS messages in Python to understand how the process works and how to use the Twilio Python library to generate dynamic TwiML.