ignacio-chiazzo / ruby_whatsapp_sdk

A lightweight, efficient Ruby gem for interacting with Whatsapp Cloud API.
https://ignacio-chiazzo.github.io/ruby_whatsapp_sdk/
MIT License
161 stars 36 forks source link

Support Image/webp #94

Closed renatovico closed 1 year ago

renatovico commented 1 year ago

Describe the bug When receive a image/webp (sticker eg) the download medias doesn't work

To Reproduce

  1. Send a sticker image
  2. Try download :)

Expected behavior Download happened

Additional context

I Made a ugly monkey patch

WhatsappSdk::Resource::MediaTypes::IMAGE_TYPES = WhatsappSdk::Resource::MediaTypes::IMAGE_TYPES.dup
WhatsappSdk::Resource::MediaTypes::IMAGE_TYPES.push("image/webp")
WhatsappSdk::Resource::MediaTypes::IMAGE_TYPES.freeze

WhatsappSdk::Resource::MediaTypes::SUPPORTED_MEDIA_TYPES = WhatsappSdk::Resource::MediaTypes::SUPPORTED_MEDIA_TYPES.dup
WhatsappSdk::Resource::MediaTypes::SUPPORTED_MEDIA_TYPES.push("image/webp")
WhatsappSdk::Resource::MediaTypes::SUPPORTED_MEDIA_TYPES.freeze

and all worked :)

ignacio-chiazzo commented 1 year ago

Hi! Thanks for reporting. We definitely need to add support for webp for stickers.

It's in the Whatsapp documentation too.

Screenshot 2023-07-23 at 7 15 24 PM

Do you want to open a PR for that? We need:

If not, I can write it. Thanks for reporting the issue!

renatovico commented 1 year ago

of course i do!