We have a whatsapp chat bot, and we want to randomly get images and send it to the user, but once I send the first image from the bot, Twilio will cache that Image and then send it over and over again not even calling the API route for that.
There's a couple of things you can do here. You can set the Cache-Control header to no-cache on the URL you are returning for the image. Or you can always return different URLs for the images.
Hey Guys, can someone help me with this:
We have a whatsapp chat bot, and we want to randomly get images and send it to the user, but once I send the first image from the bot, Twilio will cache that Image and then send it over and over again not even calling the API route for that.
How can stop we Twilio from caching the image?
Thanks in advance for the help
There's a couple of things you can do here. You can set the
Cache-Control
header tono-cache
on the URL you are returning for the image. Or you can always return different URLs for the images.There are more details in this article on how to change the cache behaviour for media message files.