0

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

1 Answers1

0

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.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • Thanks for your response but the link and the entire Twilio api documentation doesn't quite answer my question, sadly. Im thinking maybe there is someway to write to an xml file only present in memory and upload it to AWS s3 , from which the Twilio web-hooks can retrieve it. I'm unsure about how practical this would be in production but ill be sure to keep you informed. thank you – middlepost Sep 01 '21 at 11:58
  • No, you don’t need to do that. You can serve XML directly from your Python application. I think you should follow the tutorial and see how it works. – philnash Sep 01 '21 at 12:04
  • Thank you, i tried it out and it worked great – middlepost Sep 02 '21 at 16:57
  • Great news! Do you mind marking this answer as correct so that others can see it helped? Thanks! – philnash Sep 02 '21 at 23:17