Edhelvar
Edhelvar

Reputation: 186

Images in Hero Card sent through Bot Framework not updating from source

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

Upvotes: 2

Views: 531

Answers (1)

Marc Asmar
Marc Asmar

Reputation: 1577

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.

Upvotes: 2

Related Questions