``customwebhookbot.py`` ======================= This example is available for different web frameworks. You can select your preferred framework by opening one of the tabs above the code example. .. hint:: The following examples show how different Python web frameworks can be used alongside PTB. This can be useful for two use cases: 1. For extending the functionality of your existing bot to handling updates of external services 2. For extending the functionality of your exisiting web application to also include chat bot functionality How the PTB and web framework components of the examples below are viewed surely depends on which use case one has in mind. We are fully aware that a combination of PTB with web frameworks will always mean finding a tradeoff between usability and best practices for both PTB and the web framework and these examples are certainly far from optimal solutions. Please understand them as starting points and use your expertise of the web framework of your choosing to build up on them. You are of course also very welcome to help improve these examples! .. tab:: ``starlette`` .. literalinclude:: ../../examples/customwebhookbot/starlettebot.py :language: python :linenos: .. tab:: ``flask`` .. literalinclude:: ../../examples/customwebhookbot/flaskbot.py :language: python :linenos: .. tab:: ``quart`` .. literalinclude:: ../../examples/customwebhookbot/quartbot.py :language: python :linenos: .. tab:: ``Django`` .. literalinclude:: ../../examples/customwebhookbot/djangobot.py :language: python :linenos: