DEV Community

Discussion on: I Built a Python WhatsApp Bot to Keep Me Sane During Quarantine

Collapse
 
zeyu2001 profile image
Zhang Zeyu

Hi there, thanks for reading :)

Can you check whether the URL you set in the Twilio sandbox configuration includes the /bot/ at the end? In our urls.py, we have configured the application on the /bot/ URL. So if the nrgok URL is c21d2af6.ngrok.io, you would have to use c21d2af6.ngrok.io/bot/.

Alternatively, you could change this by editing this line in urls.py

path('bot/', include('bot_app.urls')),

to

path('', include('bot_app.urls'))

Let me know if this helps!

Collapse
 
mirdotbhatia profile image
Mir Bhatia

Hi, thanks for the quick response.

It still doesn't work, unfortunately. The URLs change every time the server is started, yes? I tried to play around with that and added /bot/ at the end, but it still doesn't seem to work for me.

/bot/ is added only in the Twilio config, yes? Or does that go in the python file too. It throws an error rn, but I just want to be sure.

Thread Thread
 
zeyu2001 profile image
Zhang Zeyu

Yup, the ngrok URLs change every time you start ngrok, and /bot/ is added only in the Twilio config.

Have you added the ngrok URL to your ALLOWED_HOSTS in settings.py?

Is Python raising any errors or is it just a 404? If it's just a 404, you might want to check your urls.py files in both the bot and the bot_app folder.

The source code is available at my GitHub, so you can check against that.

Thread Thread
 
mirdotbhatia profile image
Mir Bhatia

Perfect, I'll compare my code against your github repo and then let you know if something's up.

Thanks!