1

I'm developing a chatbot, with which I'm sending Hero Cards with images saved in an Azure Blob storage. I previously had a test image so use, but now I have newly designed ones to send. But the chat keeps sending the older version.

This only happens on messenger, since I've tested in the Bot Framework Emulator and it works fine (see attached).

Is there someplace where I should go and clean the cache or something to solve this?

Old: https://external.fopo2-2.fna.fbcdn.net/safe_image.php?d=AQBekbpgx0BmvlIs&url=https%3A%2F%2Fweghobot.blob.core.windows.net%2Fimages%2FHouseCleaning.PNG&_nc_hash=AQA_DeidMMXmwmEd

New: http://weghobot.blob.core.windows.net/images/HouseCleaning.PNG

enter image description here enter image description here

Edhelvar
  • 176
  • 1
  • 13
  • You can try to rename the image saved in your Azure Blob storage and update your code of creating HeroCards with new image URL. – Fei Han Jul 25 '18 at 01:59
  • 2
    This SO thread discussed ["How to clear Facebook's image cache"](https://stackoverflow.com/questions/10285522/how-to-clear-facebooks-image-cache/10289336), you can refer to it. – Fei Han Jul 25 '18 at 02:03

1 Answers1

1

What you can do is append a variable (cache-buster) with a random value each time on your image URL like the following:

string imageURL = "http://weghobot.blob.core.windows.net/images/HouseCleaning.PNG";
string imageURLWithCacheBuster = imageURL+ "?v=" +DateTime.Now.Ticks;

The random number makes every image call look unique and therefore Messenger will not find the cached item and will re-fetch your image every time.

Marc Asmar
  • 1,527
  • 1
  • 10
  • 22