# Running flask along with Rasa server

**URL:** https://forum.rasa.com/t/running-flask-along-with-rasa-server/33850
**Category:** Rasa Open Source
**Created:** [September 17, 2020, 5:16am UTC](https://forum.rasa.com/t/running-flask-along-with-rasa-server/33850 "2020-09-17T05:16:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![\_adityaK](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/_adityak/32/10899_2.png) [@\_adityaK](https://forum.rasa.com/u/_adityaK)
#### Post date: [September 17, 2020, 5:16am UTC](https://forum.rasa.com/t/running-flask-along-with-rasa-server/33850/1 "2020-09-17T05:16:42Z")

</div>

Hello,

I have created a demo.py file that would listen on **webhooks/twilio/webhook/** for the response from Twilio. The file is to know if the attachment received is pdf or not. My idea is that I would keep running this file so that every request is noted and if the user sends a file, it will send a message to the custom action. The file looks like:

```
import requests
from flask import Flask, request, redirect
from twilio.twiml.messaging_response import MessagingResponse
app = Flask( __name__ )

@app.route("/webhooks/twilio/webhook/", methods=['POST'])
def receiveMedia():

    if request.values['NumMedia'] != '0':
        # Use the message SID as a filename.
        filename = request.values['MediaContentType0'] == 'application/pdf'
        image_url = request.values['MediaUrl0']
        print(image_url)
    return ""

if __name__ == ' __main__':
    app.run(debug=True)

```

Running this file using command **python3 demo.py** and then running the Rasa server conflicts each other and when the bot is deployed, it just listens to one of the instances of the server.

Any idea where I can put this code so that every response that is coming, could be received by both chatbot and demo.py file?

Apologies if I am not very clear with my question.

Thanks. 🙂

---

<div class="post-metadata">

### Author: ![\_adityaK](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/_adityak/32/10899_2.png) [@\_adityaK](https://forum.rasa.com/u/_adityaK)
#### Post date: [September 18, 2020, 3:21pm UTC](https://forum.rasa.com/t/running-flask-along-with-rasa-server/33850/2 "2020-09-18T15:21:33Z")

</div>

I was able to accomplish this by using custom connector.
