* feat(whatsapp): add profile picture fetching for Baileys provider
- Add `get_profile_pic` method to `WhatsappBaileysService` for fetching contact avatars
- Include `avatar_url` in contact attributes during contact creation
- Update `MessagesUpsert` handler to fetch and set profile pictures
- Add proper error handling and graceful degradation when avatar fetching fails
* test(whatsapp): add test coverage for Baileys profile picture fetching
- Add test suite for `get_profile_pic` method
- Include test scenarios for successful responses, missing avatars, and error handling
- Add profile picture HTTP stubbing and avatar job expectations to message processing tests
* feat(whatsapp): optimize Baileys avatar fetching and update avatar for existing inboxes
Previously, the profile picture was fetched on every incoming message and avatar updates were only attempted for new inboxes.
This change optimizes the process by:
- Only fetching the WhatsApp profile picture if the contact does not already have an avatar.
- Attempting to update the avatar for both new and existing inboxes.
This logic is based on Telegram's version (app/services/telegram/incoming_message_service.rb).
* refactor(whatsapp): remove unnecessary safe navigation when accessing contact
This reverts an unnecessary change introduced in b918a92.
* refactor(whatsapp): manually rollback change introduced in b918a92
* refactor(whatsapp): rename endpoint to profile-picture-url
* refactor(whatsapp): simplify profile picture response handling
Replaced manual JSON parsing with HTTParty's parsed_response and removed redundant JSON parsing tests.
* test(whatsapp): separate avatar processing test from message creation test
* test(whatsapp): update profile picture test to match actual API behavior
Change test to expect a 404 response when no profile picture exists, instead of a 200 response with partial data.
* refactor: move new functions to helper module
* test: more specs
---------
Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>